Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Also log command line for still running process #1255

Conversation

remicollet
Copy link
Contributor

For now we have in log

WARNING: Process ID 1296135 still running in chroot. Killing with 15...

This is not easy to debug, especially as the process is killed, so doesn't exist anymore

With this PR we have

WARNING: Process ID 1353229 still running in chroot. Killing with 15...
WARNING: Process is datadog-ipc-helper/builddir/build/BUILDROOT/php-pecl-datadog-trace-0.93.2-1.el7.remi.7.0.x86_64/usr/lib64/php/modules/ddtrace.so/proc/self/fd/4ddog_daemon_entry_point

Which may be more useful

NOTICE: my python skill are close to 0, so this is mostly a RFE ;)

Perhaps a single line will be preferred (with cmdline instead of pid) ?

mock/py/mockbuild/util.py Fixed Show resolved Hide resolved
@@ -177,6 +177,8 @@ def orphansKill(rootToKill, manual_forced=False):
root = os.readlink("/proc/%s/root" % fn)
if compare_two_paths_cached(root, rootToKill, path_cache):
getLog().warning("Process ID %s still running in chroot. Killing with %s...", fn, killsig)
with open("/proc/%s/cmdline" % fn) as f:
getLog().warning("Process is %s", f.readline())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Can this end up with any exception that would potentially skip the os.kill() call?

@remicollet remicollet force-pushed the issue-procstillrunning branch from 7242087 to 1d6502b Compare November 14, 2023 09:29
@remicollet
Copy link
Contributor Author

Looking deeper, "cmdline" is a list of strings, with NUL as separator...
No idea how to properly format it...

WARNING: Process is datadog-ipc-helper/builddir/build/BUILDROOT/php-pecl-datadog-trace-0.93.2-1.el7.remi.7.0.x86_64/usr/lib64/php/modules/ddtrace.so/proc/self/fd/4ddog_daemon_entry_point

Should be

WARNING: Process is datadog-ipc-helper /builddir/build/BUILDROOT/php-pecl-datadog-trace-0.93.2-1.el7.remi.7.0.x86_64/usr/lib64/php/modules/ddtrace.so /proc/self/fd/4ddog_daemon_entry_point

@praiskup
Copy link
Member

Could this work?

content = fd.read() ; args = content.split("\0") ; args.pop()
print(" ".join([shlex.quote(x) for x in args]))

@praiskup
Copy link
Member

Ok, thank you for your idea here! I'm trying to finalize this in #1268, feedback is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants