-
Notifications
You must be signed in to change notification settings - Fork 483
[WIP] Acquire lock in separate thread #802
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
base: master
Are you sure you want to change the base?
[WIP] Acquire lock in separate thread #802
Conversation
f591678 to
3f1139e
Compare
3f1139e to
e55e340
Compare
|
Okay, this ended up being trickier than I thought, because not only do you need a locker thread responsible for locking the target process, but you also need to keep the So my original solution in which the locker thread finishes execution immediately, it would just instantly unpause the target thread before samples could be taken. Happily this is something we're testing for with Please let me know if you have any comments or if you feel this could be handled more gracefully, I'd be grateful for any feedback. |
a7c93d8 to
92fd140
Compare
|
Ack, I pushed the last commit after testing (and passing locally on linux), and then was away for the past couple of weeks. I see now the Windows tests are failing, but I don't know why. I'll try spinning up a VM to test this out, but any help here would be appreciated. Moving back into draft until this gets resolved. |
This PR modifies the way that the process to be inspected gets locked.
Before,
py-spywould first check the process for active threads before locking the process (otherwise all threads are reported as being idle). If the process exited before a lock could be acquired,py-spywould hang while waiting for the status of the PID to change.With this PR, acquiring the lock on the process happens in a separate thread; if the thread doesn't acquire a lock in a specified time (default is 1s, but this is a config variable. If this is too short we can increase it) we simply error out instead of hanging. Closes #732.
I've also fixed an issue with installing the
numpy>=2optional test requirement in the test workflow.