Ptvs: Debugger warnings kill import performance

Created on 12 Dec 2017  ·  6Comments  ·  Source: microsoft/PTVS

Split from https://github.com/Microsoft/PTVS/issues/3408

I also get a ton of messages on the output screen before the program loads that weren't there before in PTVS:

"Standard library module invoked user code during import; breakpoints disabled for invoked code."

If you use the classifier cookiecutter project and start debuging with a breakpoint on the read_table line (which means it imports pandas, numpy and matplotlib):

  • It takes over 120-150 secs to reach breakpoint with 1000s of warning in output window
  • It takes 5-10 secs if the warning is removed
Debugger bug Performance

Most helpful comment

@VasilijKolomiets This will be fixed in 15.6, but if you'd like, you can try patching your copy of debugger.py like I've done in the PR https://github.com/Microsoft/PTVS/pull/3476

This will get rid of the warnings.

The file is at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\Python\Core\ptvsd\debugger.py

Without seeing your code, it's hard to say why step into wouldn't work. It could be a native module, it could be it's standard library and you have debugging of standard library disabled (tools options/python/debugger). If it's none of those, please file a separate issue with details on how to reproduce the issue. Thanks!

All 6 comments

I'm curious what user code it is hitting during import, exactly. It is more likely to be a misidentification of library (or generated) code as user code.

Anyway, we should still probably keep the warning - just print it once the first time this condition is hit.

I tested by including co_filename in the warning

95% of the time it is <string>
there's a few <decorator-gen-110> where the number varies
and a few times it's the full path to ...debugger.py

We could ignore everything that starts with < (since it's not a valid filename, and therefore there can be no breakpoints in it anyway).

Update https://github.com/Microsoft/PTVS/pull/3476 to ignore more cases, and make sure it is not displayed more than once (per thread).

For the scenario I described above, it means the warning is no longer displayed at all.

I have the same message. and all works after that.
But - its near 100 times repeated!!
What to do?
Debugger don't work properly - step into (F11) don't work....
WTF?
It was in my old python project - when module mathplotlib was reading

@VasilijKolomiets This will be fixed in 15.6, but if you'd like, you can try patching your copy of debugger.py like I've done in the PR https://github.com/Microsoft/PTVS/pull/3476

This will get rid of the warnings.

The file is at C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\Python\Core\ptvsd\debugger.py

Without seeing your code, it's hard to say why step into wouldn't work. It could be a native module, it could be it's standard library and you have debugging of standard library disabled (tools options/python/debugger). If it's none of those, please file a separate issue with details on how to reproduce the issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings