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

Process hanging when using --native flag on record mode #416

Closed
Roberto09 opened this issue Jul 5, 2021 · 3 comments
Closed

Process hanging when using --native flag on record mode #416

Roberto09 opened this issue Jul 5, 2021 · 3 comments

Comments

@Roberto09
Copy link

Hi! as mentioned in the past I really like your software and I've been using it a lot recently.

I was very occasionally running into an issue where the process I'm trying to monitor would hang after I finished py-spy with crtl + c; the way I'm running py-spy is the following:

py-spy record --native --pid 1234

And what happened was that when I looked into the process I'm trying to monitor by doing ps aux I noticed that the state of the process was "T" which means "stopped, either by a job control signal or because it is being traced.". My understanding is that this state could be reached by sending SIGSTOPs to a given proces; I haven't looked very deep into the logic used by py-spy's code whenever the native flag is set but my guess is that maybe what's happening under the hood is that SIGSTOPs + SIGCONTs are being sent to look at the stacktrace of the process in between and, if someone happens to pres ctrl + c in between that time-span the process being monitored will remain in a SIGSTOP state as a SIGCONT wouldn't be send by py-spy on finalization by doing ctrl+c.

I was wondering if by any chance this could be possible?

Thanks!:)

@benfred
Copy link
Owner

benfred commented Jul 5, 2021

We have a control-c handler in py-spy - so we should clean up and resume the python process when py-spy exits. However, there have been issues around this before .

What version of py-spy are you using? I'm wondering if this is the same issue as in #390 . If you aren't on py-spy v3.7 can you try upgrading and see if that resolves?

@Roberto09
Copy link
Author

I see; I'm using py-spy 3.5; I'll do some tests using the later version and let you know tomorrow, hopefully it's the same thing; thanks for looking into this!!
:)

@benfred
Copy link
Owner

benfred commented Jul 31, 2021

I'm guessing that this is because you're on 0.3.5 - so I'm going to close. Please re-open if this is still happening for you in the latest version

@benfred benfred closed this as completed Jul 31, 2021
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

No branches or pull requests

2 participants