Repository navigation
After upgrade to 2025.0.0 : "Server[pid=x] is already being debugged" error #592
Description
Activity
- addedtriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
on Feb 7, 2025 SherekhanFR I downgraded the version of the extension "Python Debugger" to v2024.14.0, now debugging of azure functions is working again
Reacted by Howie Wangthank you for downgrading the version of the extension "Python Debugger" to v2024.14.0. It solved my issue too.
This happens when I have multiple VS Code windows open with Python projects:
- run
debugpyfrom the terminal as per No‐Config Debugging - notice the other VS Code windows error with "Server[pid=x] is already being debugged"
These are standard python projects, not Azure functions.
Reacted by PakitoSec, Howie Wang and RACZ Andras- run
This is particular annoying - is there a way to disable the new No‐Config Debugging and only opt-into that feature?
Reacted by TacoSame issue here. An opt out would be highly appreciated. I suspect it has to do when multiple windows are open, causing multiple windows to try to connect and oftentimes the wrong window ending up connecting....
Yep indeed - my current workaround is to close all other windows except the one for the repo I'm trying to debug, but this is kind of a time-sync [I'd rather prefer having the option to / being able to attach to a remote debug server "manually" as before].
I also tried to remove all debug configurations that reference the respective port that debugpy is listening on hoping that then that particular window won't try to connect, but seems like the debug configs aren't even respected by the no-config debugging [as the name suggests 😄]
Hi! Sorry about this. Can people describe how exactly they are debugging and the expected vs actual behavior. Are people trying to debug through the terminal without using no-config debug? By multiple windows can you describe those more, are they windows in the same workspace?
I want to add that I receive this error with only one VS Code instance open, but then again I'm using the "Blender Development" extension which attaches the Python debugger to Blender behind the scenes, showing said message box. (I also returned to the last 2024 version to get around this issue.)
The first pre-release version where this issue appears is 2024.15.2025011702
Reacted by Howie WangMy environment
- I work in a monorepo and use git worktree to check out multiple branches in parallel, each branch checked out in a different folder. I have a vscode window open at the root of each checked out branch.
- For context: git worktree allows me to have 1 bare clone of the repo and then have multiple branch checkout folders from that bare clone. On disk, it is very similar to just having multiple clones of the same repo in different folders, except that its much more disk-storage efficient (you only need to maintain 1 git graph, including the fetched origin, on disk).
- Another peculiar thing about my setup is that all my branch checkout folders use the same
.vscodeworkspace settings folder: At the root of each branch checkout folder I have a symlink to 1 shared.vscodeworkspace settings folder. This is to work around limitations of the VS Code config system (let's not go into that here).
- I start my command from the VS Code integrated terminal. I set up the debug server programmatically in my command (this is because of how it integrates with the bazel build system I use), as shown below.
- Additionally, some tricks are done to make the python program hermetic in the bazel build system. I don't think its relevant, but just putting it out there in case there is overlap with the environment of others following this ticket.
- I never opted in to no-config. I think the ability to opt-out is a must have (although I agree that moving towards not needing to ever opt out is desirable, I doubt how realistic that is in short term).
- Even without the multi-window issue that we're all having, I think allowing people to opt out of no-config is desirable, as it allows tweaking the config settings (e.g. to tweak the
justMyCodesetting).
- Even without the multi-window issue that we're all having, I think allowing people to opt out of no-config is desirable, as it allows tweaking the config settings (e.g. to tweak the
Expected vs actual
- Expected behavior: waiting for me to attach (which I'd starting a debugging sessions using my own launch.json debugging config)
- Actual behavior: auto-attaches and generally attaches to the wrong window. I'm getting error "Server[pid=x] is already being debugged" in all (or some?) other windows. My mileage varies (sometimes it doesn't even try to auto attach?).
More details on my setup
Programatic debugger setup:
os.environ["PYDEVD_RESOLVE_SYMLINKS"] = "1" debugpy.listen(("localhost", 5678)) debugpy.wait_for_client()
launch.jsonconfig entry:{ "name": "Python: Attach", "type": "debugpy", "request": "attach", "connect": { "host": "localhost", "port": 5678 }, "subProcess": true },Explaining my folder setup:
$HOME/devbare_clone(for git worktree)worktree_checkout_branch1: based off bare_clone..vscode -> $HOME/dev/.vscode(symlink)
worktree_checkout_branch2: based off bare_clone..vscode -> $HOME/dev/.vscode(symlink)
.vscode
- I work in a monorepo and use git worktree to check out multiple branches in parallel, each branch checked out in a different folder. I have a vscode window open at the root of each checked out branch.
Eleanor Boyd (@eleanorjboyd), could we prioritize providing an extension setting to disable no-config?
Reacted by Taco and Howie WangHello! Apologies on missing responding to this thread! I have made a change to how no-config debugging works that should solve the issue you are facing since it only does setup for no-config debug once you have called it which will stop it from conflicting with existing work scenarios that use
debugpyfrom the terminal as is. I added in in response to this other thread but forgot to tag this thread as a duplicate of it. This fix is out on the pre-release of the debugger extension so if anyone gives it a try please let me know if it does in fact fix your bug. Thanks!Thanks. I'll give it a spin. I'd still strongly suggest we add an explicit opt-out preference.
looping in Karthik Nadig (@karthiknadig) and Courtney Webster (@cwebster-99) for their thoughts on that explicit setting
Can confirm that the "Blender Development" extension no longer shows the message and works as before / as it should.
Reacted by Eleanor Boydkarthiknadig commented
on Feb 26, 2025 MemberMore actionsEleanor Boyd (@eleanorjboyd) I think your fix decouples the
debugpyenv variable switch that case this issue. Let us see, if there are cases where it interferes with runningdebugpydirectly. We can add a setting if it does.Reacted by Eleanor Boyd
Hello,
since I upgraded to version 2025.0.0, I get error "Server[pid=x] is already being debugged" while debugging Python Azure Function.
if I downgrade to version 2024.14.0 it is working fine.
VSCode on Mac :
Version: 1.97.0
Commit: 33fc5a94a3f99ebe7087e8fe79fbe1d37a251016
Date: 2025-02-04T22:41:26.688Z (2 days ago)
Electron: 32.2.7
ElectronBuildId: 10660205
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin x64 20.6.0
launch.json
ms-python.debugpy log file