Open 1C4nfaN opened 1 year ago
It seems that the function doesn't cope with process comms that have ) in them. Not a very common case for Python processes, but I suppose no reason not to support it properly. The logic needs to be "parse from the first ( until the matching )" or maybe just "parse the last )" instead of "the first )".
from @Jongy
Originally posted: https://github.com/benfred/py-spy/issues/565#issuecomment-1505067511
I also encountered this. In my case, I think the culprit was PyQt5 and QThreadPool. It looks like this:
$ cat /proc/13793/stat
13793 (Thread (pooled)) S 13689 13689 13688 34828 13689 4194368 64199 549 0 ...
For anyone else who runs into this, it seems to already be fixed in remoteprocess 0.4.12 and py-spy master branch.
Below are the contents of
/proc/{pid}/stat
for two processes.When we try to use
py-spy dump --pid 1984043
, then we get the following errorError: Failed to parse /proc/1984043/stat
.I think the problem should lie in the judgment of this code for the case of
'))'
(in remoteprocess)I thought I'd make a note of the issue here, though I'm not very familiar with the code that actually executes in process 1984043, I will try to check this and if necessary I'd willing to fix it if I had time.