-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debugger Heisenbug where integer comparison appears to fail within a specific context #346
Comments
I couldn't readily repro it with these steps, unfortunately. It might be that there's some hidden variable at play here.... Can you check something on your repro? When you step through the program, if you have the Run view open, you should be seeing line numbers in the Call Stack section. Do they reflect the highlighted line in the editor? Or are they correct, but the editor is highlighting the wrong line? |
Can you try setting |
Setting "env":{"PYDEVD_USE_FRAME_EVAL": "NO"} in launch.json solves the problem. Thank you! Should I add this to all of my launch.json files until a bug fix is pushed out? |
It would probably be easiest to just set it as a global environment variable - that way it'll also apply to "attach" sessions. |
I'm looking forward to a more permanent bug fix. |
@fabioz, can you take a look? It might be a rare corner case, but changing behavior of running code like that is very concerning. |
Sure, I'll give priority to this issue. |
The crucial requirement for the repro is Python 3.7, although I suspect this has more to do with us only shipping Cython binaries for that. |
Note: I'm able to reproduce this and I'm investigating it (took me a bit more than I expected today because I ended up having to reinstall my Linux VirtualBox image which became corrupted). |
The issue is related to the bytecode modification in the frame eval mode -- I'm still working on it. |
Note: just to give more feedback, I'm still working on this. I've actually found more issues related to that on the frame eval mode as I started doing some more tests on this, so, I'm actually scrapping the code related to the bytecode rewrite and doing the bytecode rewrite using https://github.com/vstinner/bytecode, which should allow for a better API for bytecode manipulation. I think I'll be able to finish it next week. |
I'm seeing the same problem, python 3.7, the environment variable fix resolves the problem. |
This is still valid on build: 1.74.3 "PYDEVD_USE_FRAME_EVAL": "NO" doesn't work as a fix anymore. |
Are you doing an attach, by chance? Putting stuff in "env" only works for launch, otherwise environment variable has to be set specifically for the process you're attaching to when it's started. If that doesn't solve the problem, can you please file a new issue? |
Environment data
VS Code version:
Version: 1.47.2
Commit: 17299e413d5590b14ab0340ea477cdd86ff13daf
Date: 2020-07-15T18:22:15.161Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.4.0-42-generic snap
Extension version (available under the Extensions sidebar):
ms-python.python v2020.7.96456
OS and version:
LSB Version: core-9.20170808ubuntu1-noarch:security-9.20170808ubuntu1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
Python version (& distribution if applicable, e.g. Anaconda):
Anaconda Python 3.7.7
Type of virtual environment used (N/A | venv | virtualenv | conda | ...):
Python 3.7.7 64-bit ('base':conda)
Relevant/affected Python packages and their versions:
jsonpickle 1.4.1
numpy 1.18.1
SQLAlchemy 1.3.17
Relevant/affected Python-related VS Code extensions and their versions:
ms-python.python v2020.7.96456
Value of the
python.languageServer
setting:Microsoft
Expected behaviour
When debugging the attached file and stepping into main on line 33 with no arguments, the value of len(sys.argv) is 1, so the comparison N>=2 on line 35 should be False and the debugger should step to the else statement on line 39.
Actual behaviour
The debugger steps to line 36 as if N>=2 were True. It also incorrectly steps to line 42 after comparing N>=3.
Steps to reproduce:
Debug the attached file and step into main on line 33 with no arguments, then see if the debugger steps to line 36 or 39. All settings are default with a fresh install of vscode and the python extension.
I have spent many hours trying to isolate the minimal code required to demonstrate this bug. As far as I can tell, every line of uncommented code in this file is required to demonstrate the problem. Furthermore, adding print statements before or after the bug makes it disappear.
If further evidence of this bug is needed, then please ask and I will provide a .gif.
Logs
Nothing appears in the Output panel. In the terminal, the following appears:
cd /home/username ; env /home/username/anaconda3/bin/python /home/username/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/lib/python/debugpy/launcher 39939 -- /home/username/vscode_debuger_bug.py
1
Code
The text was updated successfully, but these errors were encountered: