-
Notifications
You must be signed in to change notification settings - Fork 137
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
Some packages like glfw
blocks forever while communicating with a subprocess
#1096
Comments
glfw
blocks forever while invoking Popen.communicate
glfw
blocks forever while communicating with a subprocess
This could've been caused by the issue fixed in: ea423ae (which is still not released). Can you try to apply that change locally and see if it fixes it for you? i.e.: Run in the debugger:
Then open that file and add the code below in the
|
One question here: do you know if neovim can deal with auto-attach of subprocesses? i.e.: in multiprocess mode the debugger may request (through a custom message) that the client creates a new debug session in another port to debug a subprocesses, but if the client doesn't do the attach, it's quite possible that it'll just linger there and not do anything. The workaround if the client can't do that auto-attach is asking that mode to be disabled (i.e.: |
Probably not yet. It looks like there were some efforts for this, mfussenegger/nvim-dap-python#21. Maybe the author of nvim-dap @mfussenegger could please give some insight on this?
This is it! We may want to have -- A workaround for nvim-dap and nvim-dap-python users.
-- put these somewhere after require('dap-python').setup {}
local configurations = require('dap').configurations.python
for _, configuration in pairs(configurations) do
configuration.justMyCode = false
configuration.subProcess = false -- <----------- this line!
end |
According to mfussenegger/nvim-dap-python#21, it seems that nvim is waiting for the start debugging reverse request to add that support (this is being tracked in debugpy in #1074, but it's still not even a part of the official debug adapter protocol specification, so, it may still take a while). In the meanwhile, nvim should always set |
Thanks @fabioz, it was great to figure out why this bug is happening and it is not really a debugpy problem. For the time being I'm fine with the |
Until the `startDebugging` request is implemented in both nvim-dap and debugpy it's safer to set it to false as it can cause issues with some packages. See microsoft/debugpy#1096
Until the `startDebugging` request is implemented in both nvim-dap and debugpy it's safer to set it to false as it can cause issues with some packages. See microsoft/debugpy#1096
Before creating a new issue, please check the FAQ to see if your question is answered there.
Environment data
glfw.__version__
: '2.5.5'Actual behavior
When importing
glfw
which internally usesctypes.CDLL
, the process blocks forever. This happens only when running via debugpy with as neovim DAP client; unfortunately, it did not happen when running via VS Code + debugpy.The line that causes a deadlock or indefinite blocking is
subprocess.Popen(...).communicate
: glfw/library.py#L115. Looks like a patched version of multiprocess/subprocess is causing some problem.Steps to reproduce:
I was running the following single-file script via debugpy.
More information
Stacktrace tells (
py-spy dump --pid PID
) it is blocked at_glfw_get_version (glfw/library.py:115)
, or more precisely, duringPopen(...).communicate()
call -- see glfw/library.py#L115.Click to expand the full stack trace
I could see the subprocess spawned but via pydevd and debugpy as follows:
The subprocess command line (prettified)
Please note that the above code originates from https://github.com/FlorianRhiem/pyGLFW/blob/master/glfw/library.py#L69.
I was trying to reproduce the bug by launching server and client processes via command line (rather than neovim DAP), but I failed due to my ignorance. I was unable to reproduce this in a VS Code environment. If you have hard time reproducing the bug with a neovim setup, please let me know so I can try more (or please let me know some instructions). Or would it be a bug of the python DAP adapter?
Expected behavior
The above code should run without any problem as when running without debugpy.
Workaround
As a temporary workaround, I'm patching the
glfw.library
so that_glfw_get_version
simply returns(3, 3, 7)
(depending on the actual .so file) or runs the program in the same process.The text was updated successfully, but these errors were encountered: