question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Multithreaded Application under debugger very slow.

See original GitHub issue

I 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

  1. python3 -m venv venv3
  2. source venv3/bin/activate
  3. pip install google-cloud-firestore

In VS Code

  1. Set breakpoint on line 64 doc_ref.set({ which follows the call to spawn threads
  2. run current file for repro.py

Logs

Output for Python in the Output panel (ViewOutput, 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
crwilcoxcommented, Oct 9, 2018

@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!

1reaction
crwilcoxcommented, Aug 30, 2018
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found