-
Notifications
You must be signed in to change notification settings - Fork 145
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
Debugger Dies in Multiprocessing Env #1767
Comments
Thanks for the bug report and sorry for the delay, could you send me your launch.json configuration? Thanks |
Hey @karthiknadig, this issue might need further attention. @95anantsingh, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
@karthiknadig I used the default {
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
} |
Hey @karthiknadig, this issue might need further attention. @95anantsingh, you can help us out by closing this issue if the problem no longer exists, or adding more information. |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
This looks like a bug in Debugpy. |
Closing as this is an old bug and we haven't seen any other people reporting this. |
Tested it and it works for me with 3.13 |
@rchiodo I tested it, its still there. Should I send a video? |
Make sure you're using the latest version of debugpy. If you're inside VS code, make sure it's the prerelease version of the debugpy extension. If you're doing this manually, make sure it's the latest debugpy (which is 1.8.9 at the moment) |
After switching to pre release version (v2024.13.2024112901 (pre-release)) it takes longer to die, around 40 sec. But it still does. I am not sure how to get the internal version of debugpy at the extensions tab I could only see v2024.13.2024112901 (pre-release). |
You're saying your breakpoint is never hit? For me it hits the breakpoint just fine: If you never hit the breakpoint, you can turn on logging as described here: The pydevd log should tell us if something didn't work. Maybe there's a path mapping issue. |
It hits, but wait there for 40 seconds and the process will exit without intervention. Ideally it should stay alive indefinitely. |
Oh that makes sense though. You're not waiting for the subprocess in the main process. The main process exits and so the child process is killed. |
I think the only way to do what you want would be to attach to the subprocess instead. |
As I have observed the debugger attaches to subprocess as well in this code automatically. Another thing is that this doesn't happen with threads |
Threads wouldn't have this problem. The main thread wouldn't exit because the other thread is at a breakpoint (meaning all threads are suspended). The weird part is the 40 seconds though. I agree it should exit almost immediately. |
Looking at the logs from a run, the child process isn't killed by the debugger. I think VS code might be shutting it down. Pydevd log shows this for the subprocess as the last item:
So it never receives a terminate, meaning the main process exiting doesn't actually cause it to die. But in the vscode logs, I can see this in the log for the subprocess:
Which looks like we get the terminated event and then some time later, VS code disconnects (sends the disconnect command). There might be a bug here in that the subprocess is sending a terminate event. |
Type: Bug
Behaviour
Expected vs. Actual
Launching a debugger instance when multiprocessing is involved causes the debugger to exit without any error.
When
process.join()
is added to the code it works fine but not without it.Steps to reproduce:
Add a breakpoint at
time.sleep(5)
line and wait few secondsDiagnostic data
python.languageServer
setting: DefaultOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.22.1
VS Code version: Code 1.85.2 (Universal) (8b3775030ed1a69b13e4f4c628c612102e30a681, 2024-01-18T06:40:32.531Z)
OS version: Darwin arm64 23.2.0
Modes:
Connection to 'attached-container+7b22636f6e7461696e65724e616d65223a222f6a756e6f2d646576222c2273657474696e6773223a7b22636f6e74657874223a226465736b746f702d6c696e7578227d7d' could not be established
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Connection to 'attached-container+7b22636f6e7461696e65724e616d65223a222f6a756e6f2d646576222c2273657474696e6773223a7b22636f6e74657874223a226465736b746f702d6c696e7578227d7d' could not be established
A/B Experiments
Tasks
The text was updated successfully, but these errors were encountered: