Multithreaded Application under debugger very slow.
See original GitHub issueI have an application/library that uses multiple threads. It normally runs in a few seconds, but when launched under the debugger using python (current file)
Environment data
- VS Code version: Version 1.25.0-insider (1.25.0-insider)
- Extension version (available under the Extensions sidebar): 2018.6.0
- OS and version: Mac OS 10.13.5 (Macbook Pro 2017 15 inch)
- Python version: CPython 3.6.5 installed via PyEnv
- Type of virtual environment used : venv
Actual behavior
Code runs quickly to the point where threads are spun up. Then, it doesn’t hit the following line of the main thread.
Attempting to pause doesn’t seem to work.
If you set no breakpoints it does run to completion without issue.
Expected behavior
Expect after the threads are started (less than a second of time) for the next line of the main program to be reached by the debugger.
Steps to reproduce:
I was able to reduce this to three files: watch.py, bidy.py, repro.py Archive.zip
Setup Environment
python3 -m venv venv3
source venv3/bin/activate
pip install google-cloud-firestore
In VS Code
- Set breakpoint on line 64
doc_ref.set({
which follows the call to spawn threads - run current file for repro.py
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
> cd /Users/crwilcox/workspace/repro-vscode ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /Users/crwilcox/workspace/google-cloud-python-firestorewatch/venv3/bin/python /Users/crwilcox/.vscode-insiders/extensions/ms-python.python-2018.6.0/pythonFiles/PythonTools/visualstudio_py_launcher.py /Users/crwilcox/workspace/repro-vscode 56482 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput /Users/crwilcox/workspace/repro-vscode
/repro.py
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Why does my code run slower with multiple threads than with ...
Your application is not running slower due to debugging symbols, its running slower because of less optimization done by the compiler.
Read more >Debug multithreaded applications - Visual Studio (Windows)
Simple techniques that can be useful for debugging native threads. Give your thread a name that you view in the Threads window.
Read more >Debugger severely affects execution performance when ...
I've found that the issue is exponentially worse if the first-chance-exceptions occur on multiple threads, which is more common when dealing with web ......
Read more >Very slow debugger in pycharm
When I look at htop I see a single core just getting maxed but little to no activity on any other cores. Was...
Read more >The Dark Secrets Of Faster Compilation With Delphi
If your Delphi application does not scale on a new multiprocessor, multicore, or multithreaded hardware, the obstacle might be lock contention ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DonJayamanne Gladly. I am still trying to figure out how to describe what is happening but as soon as I nail down what is going on I will open a new issue. Thanks!
@brettcannon , filed at ptvsd as https://github.com/Microsoft/ptvsd/issues/776