Skip to content
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

PtvsdWheels37 - experiment breaks the debugger under windows #140

Closed
Hecatron opened this issue Apr 24, 2020 · 12 comments
Closed

PtvsdWheels37 - experiment breaks the debugger under windows #140

Hecatron opened this issue Apr 24, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@Hecatron
Copy link

Environment data

  • PTVSD version: Python Extension version 2020.4.74986 under VSCode (latest)
  • OS and version: Windows 10 Pro 1903
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.3 64bit windows standard
  • Using VS Code or Visual Studio: VSCode

Actual behavior

This is similar to what other users have been seeing but the symptoms were a little different in my case which is why I raised a new issue. The debugger just wouldn't launch at all

Under Log Windows:

[2020-04-24 02:06:13.983] [renderer1] [error] timeout after 1000 ms: Error: timeout after 1000 ms
    at t.RawDebugSession.handleErrorResponse (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3044:67)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3043:339
    at async t.RawDebugSession.shutdown (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3041:336)

as per #108 adding the following to the user settings file fixed it

    "python.experiments.optOutFrom": [
        "PtvsdWheels37 - experiment"
    ]

I did try disabling all other extensions (except for cosmetic ones) and tried this out with a project that worked before. (one that I came back to which I knew worked before the updates)

maybe this is an issue for https://github.com/Microsoft/vscode-python instead I'm not sure (if they're using an older version than they should be)

Steps to reproduce:

  1. Run the Python debugger
@Hecatron
Copy link
Author

Just to add my pythonpath is set to a virtual environment directory instead of the usual C:\Python37

@int19h
Copy link
Contributor

int19h commented Apr 24, 2020

If you do import debugpy; print(debugpy.__version__) at the very beginning of your script, what does it say?

@Hecatron
Copy link
Author

I just tried that but I don't think it gets that far
the output appears to be the same with that one line at the top

[2020-04-24 02:31:03.050] [renderer1] [error] timeout after 1000 ms: Error: timeout after 1000 ms
    at t.RawDebugSession.handleErrorResponse (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3044:67)
    at file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3043:339
    at async t.RawDebugSession.shutdown (file:///C:/Program Files/Microsoft VS Code/resources/app/out/vs/workbench/workbench.desktop.main.js:3041:336)

for info for the launh.json (vscode) I'm using

    "version": "0.2.0",
    "configurations": [
    
        {
            "name": "Python: arduino-dlang",
            "type": "python",
            "request": "launch",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/../../arduino_dlang/arduino_dlang.py",
            "args": [],
            "env": {
                "PYTHONPATH" : "${workspaceFolder}/../../",
            },
        },

Just in case it's something odd to do with the use of a python virtual environment

@Hecatron
Copy link
Author

Hecatron commented Apr 24, 2020

just tried it with the fix in place, but it didn't seem to find the debugpy module
I think its the version bundled with this release https://github.com/microsoft/vscode-python/releases/tag/2020.4.74986

@int19h
Copy link
Contributor

int19h commented Apr 24, 2020

It does use it - the difference between being in the experiment or not is whether you're using debugpy or not; the name is somewhat misleading (it's from before we renamed ptvsd 5.x to debugpy).

Can you share what it looks like in the terminal? Both the command line that it submits, and any resulting output, if there is one.

Also, try adding "logToFile": true to launch.json - that should generate some log files (debugpy*.log) in the folder where the extension is installed - you should be able to see that path in the terminal when you run things.

@Hecatron
Copy link
Author

I just had a dig through the changelog file in the installed directory, I think it's using v1.0.0b5 for debugpy

with logging added to launch.json

debugger.vscode_cc7caf96-c7ca-4c82-8dfe-19143a4d0be9.log

0 Starting Session:
{
    "name": "Python: arduino-dlang",
    "type": "python",
    "request": "launch",
    "cwd": "D:\\SourceCode\\Private\\Hecatron-Private\\arduino-dlang\\examples\\blinky-c-example",
    "program": "D:\\SourceCode\\Private\\Hecatron-Private\\arduino-dlang\\examples\\blinky-c-example/../../arduino_dlang/arduino_dlang.py",
    "args": [],
    "env": {
        "PYTHONPATH": "D:\\SourceCode\\Private\\Hecatron-Private\\arduino-dlang\\examples\\blinky-c-example/../../",
        "PYTHONIOENCODING": "UTF-8",
        "PYTHONUNBUFFERED": "1"
    },
    "logToFile": true,
    "pythonPath": "d:\\SourceCode\\Private\\Hecatron-Private\\arduino-dlang\\examples\\blinky-c-example/../../virtenv/py37dev/Scripts/python",
    "envFile": "d:\\SourceCode\\Private\\Hecatron-Private\\arduino-dlang\\examples\\blinky-c-example/.env",
    "stopOnEntry": false,
    "showReturnValue": true,
    "console": "integratedTerminal",
    "internalConsoleOptions": "neverOpen",
    "debugOptions": [
        "ShowReturnValue",
        "FixFilePathCase"
    ],
    "justMyCode": true,
    "workspaceFolder": "d:\\SourceCode\\Private\\Hecatron-Private\\arduino-dlang\\examples\\blinky-c-example"
}
1 Error:
{}
3 Client --> Adapter:
{
    "command": "disconnect",
    "arguments": {
        "restart": false
    },
    "type": "request",
    "seq": 1
}
3 Client --> Adapter:
{
    "command": "initialize",
    "arguments": {
        "clientID": "vscode",
        "clientName": "Visual Studio Code",
        "adapterID": "python",
        "pathFormat": "path",
        "linesStartAt1": true,
        "columnsStartAt1": true,
        "supportsVariableType": true,
        "supportsVariablePaging": true,
        "supportsRunInTerminalRequest": true,
        "locale": "en-gb",
        "supportsProgressReporting": true
    },
    "type": "request",
    "seq": 2
}
1506 Stopping Session

@Hecatron
Copy link
Author

I checked all the other log windows under vscode but couldn't find any other text

@int19h
Copy link
Contributor

int19h commented Apr 24, 2020

You've mentioned that you're using a virtual environment. Does it work for you if you try with a global interpreter? This should also let you get the version number out of it.

@Hecatron
Copy link
Author

I had a look at the vscode extensions directory

under C:\Users\ric.vscode\extensions\ms-python.python-2020.4.74986\pythonFiles\lib\python\debugpy\wheels\debugpy_version.py
it lists

# This file was generated by 'versioneer.py' (0.18) from
# revision-control system data, or from the parent directory name of an
# unpacked source archive. Distribution tarballs contain a pre-generated copy
# of this file.

import json

version_json = '''
{
 "date": "2020-04-15T13:29:45-0700",
 "dirty": false,
 "error": null,
 "full-revisionid": "ade162b1d31f989548bf7c4c647694e02f0b4ef0",
 "version": "1.0.0b7"
}
'''  # END VERSION_JSON


def get_versions():
    return json.loads(version_json)

@int19h
Copy link
Contributor

int19h commented Apr 24, 2020

Thank you! This confirms that it's not one of the original issues with the same symptoms - those should all be resolved in b7.

Did running it without virtual environment work for you, or are you running into the same problem regardless?

@int19h
Copy link
Contributor

int19h commented Apr 24, 2020

One other thing that'd be interesting to try is to start the debug adapter manually, and then tell VSCode to use it. To start it, run this in the terminal:

py -3 ...\debugpy\adapter --port 8765 --log-stderr

and then add the following to your launch.json:

"debugServer": 8765,

That way, we should be able to observe any early failures.

@int19h
Copy link
Contributor

int19h commented Jun 19, 2020

Please re-open and attach the logs if you can still repro this on the most recent version of the Python extension and debugpy.

@int19h int19h closed this as completed Jun 19, 2020
@int19h int19h added the bug Something isn't working label Jun 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants