vscode-python: "RuntimeError: already started" after VSCode Update.
Environment data
- VS Code version: 1.46.1
- Extension version: v2020.6.89148
- OS and version: Mint 19.3 Cinamon
- Python version: Python3.6
- Type of virtual environment used: virtualenv + virtualenvwrapper
- Relevant/affected Python packages and their versions: XXX
- Relevant/affected Python-related VS Code extensions and their versions: XXX
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): XXX - Value of the
python.languageServer
setting: XXX
I have been using VSCode to debug Python for almost a year now with the following run configuration from my launch.json file:
{
"name": "Microservices",
"type": "python",
"request": "launch",
"program": "/home/user/.virtualenvs/core-microservices/bin/gunicorn",
"gevent": true,
"args": [
"main:app",
"--bind=127.0.0.1:8080",
"--worker-class",
"eventlet",
"-w",
"4",
"--timeout=7200"
],
"envFile": "${workspaceFolder}/microservices.env",
"postDebugTask": "killdebugger"
}
After the last update, when I try to run the debugger I get the following stack trace:
[2020-06-19 18:24:23 -0300] [18447] [INFO] Unhandled exception in main loop
Traceback (most recent call last):
File "/home/mauricio/.virtualenvs/core-microservices/lib/python3.6/site-packages/gunicorn/arbiter.py", line 203, in run
self.manage_workers()
File "/home/mauricio/.virtualenvs/core-microservices/lib/python3.6/site-packages/gunicorn/arbiter.py", line 545, in manage_workers
self.spawn_workers()
File "/home/mauricio/.virtualenvs/core-microservices/lib/python3.6/site-packages/gunicorn/arbiter.py", line 616, in spawn_workers
self.spawn_worker()
File "/home/mauricio/.virtualenvs/core-microservices/lib/python3.6/site-packages/gunicorn/arbiter.py", line 567, in spawn_worker
pid = os.fork()
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 528, in new_fork
_on_forked_process()
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 50, in _on_forked_process
pydevd.settrace_forked()
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/_vendored/pydevd/pydevd.py", line 2427, in settrace_forked
patch_multiprocessing=True,
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/_vendored/pydevd/pydevd.py", line 2179, in settrace
wait_for_ready_to_run,
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/_vendored/pydevd/pydevd.py", line 2230, in _locked_settrace
debugger.connect(host, port) # Note: connect can raise error.
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/_vendored/pydevd/pydevd.py", line 1060, in connect
s = start_client(host, port)
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/pydevd_hooks.py", line 136, in _start_client
return start_client(daemon, h, p)
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/log.py", line 110, in g
return f(*args, **kwargs)
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/pydevd_hooks.py", line 74, in start_client
sock, start_session = daemon.start_client((host, port))
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/daemon.py", line 214, in start_client
with self.started():
File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
return next(self.gen)
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/daemon.py", line 110, in started
self.start()
File "/home/mauricio/.vscode/extensions/ms-python.python-2020.6.89148/pythonFiles/lib/python/old_ptvsd/ptvsd/daemon.py", line 145, in start
raise RuntimeError('already started')
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- Just try to debug a python application with the latest version of the VScode editor and the Python Extension as well.
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging
)
XXXX
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16
This commit removes the experiment along with the old debugger, so it actually fixes this issue, in a sense. But it was only merged 3 days ago, so it’s only present in insiders build, not in stable.
(Consequently, if you want a quick workaround - just install insiders!)
Looks like everybody received the fix, so I’m going to go ahead and close this.
@int19h You are correct. I have just removed the options for “python.experiments.optInto” from my settings.json (which solved the issue originally for me) and my multiprocessing code still works! Great, thank you!
This should now be fixed. Can you please try restarting VSCode, and see if everything works for you now?
To work around without insiders build, please add the following to your settings.json:
To be clear, this is still a bug, and the above is a temporary workaround. We’re investigating the root cause.