Make debugger gevent compatible
See original GitHub issueFrom @underyx on June 5, 2017 10:27
Environment data
VS Code version: 1.12.2 Python Extension version: 0.6.4 Python Version: 2.7.13 OS and version: macOS Sierra
Actual behavior
Running apps that use gevent/eventlet/greenlet/green threads/etc. with the debugger active causes the app to just freeze early on. This is the same behavior that I see when I run the same app with the PyCharm debugger with its ‘Gevent compatible’ switch turned off.
Expected behavior
They should work just like synchronous apps. In PyCharm, there’s an option for this called ‘Gevent compatible’ on the debugger settings page, that sounds like a reasonable thing to have here as well.
Steps to reproduce:
- Take any Python application.
pip install gevent
.- Add
from gevent import monkey; monkey.patch_all()
in the app’s__init__.py
. - Try to run it with the debugger.
Settings
Your launch.json (if dealing with debugger issues):
{
"name": "my api",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "env/bin/gunicorn",
"args": [
"--config=.misc/gunicorn_config.py",
"--reload",
"myapi"
],
"cwd": "${workspaceRoot}",
"env": {},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
]
},
``
Your settings.json:
```json
{
"python.pythonPath": "env/bin/python"
}
Logs
Output from Python
output panel
(empty)
Output from Console window
(Help->Developer Tools menu)
(empty)
Edit: oh wow, 1000! 🎊
Copied from original issue: DonJayamanne/pythonVSCode#1000
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top GitHub Comments
Here’s a quick report on what I’ve been up to:
threading
ortime
does not induce any issues. I’ll try manipulating sockets next as per the traceback below.GEVENT_SUPPORT
environment variable. Adding"env": {"GEVENT_SUPPORT": "False"}
to my launch configuration for the above mentioned complex real-life app got it running 🎉gevent freeze traceback
Python 2.7.15 with
gevent==1.2.2
To-do
"debugGevent": true,
option topythonExperimental
launch configurationsPython Experimental: Gevent
launch configuration templateA vscode-python test is not needed as it would be flaky anyway.