Comment 2 for bug 1474030

Revision history for this message
Adam Collard (adam-collard) wrote :

I hit this same traceback but diagnosed it differently.

When pgrep_full is used, it looks for the script name in the full command line of all processes. Unfortunately "juju run pgrep foo" is also running, so when we pgrep -a for foo we'll find the juju process. In charm-helpers, there's a "| grep -v pgrep" which I assume is trying to work around this case. Given that the main call to pgrep is only configured to output PIDs though, it's something which will never get excluded. The fix I was going to propose added -a to the pgrep command and then processed the results accordingly.

We should still have handling for when pgrep finds a PID but then fails to look at the mtime of /proc/$pid though since the process might well go away between the two commands.