Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Debugging fails with timeout when using conda run #1944

Closed

Description

@karrtikr

Karthik Nadig (@karthiknadig)

Environment data

  • PTVSD version: 5.0.0a7
  • OS: Windows_NT x64 10.0.18363
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.4 , Anaconda
  • Using VS Code or Visual Studio: Version: 1.41.0-insider (user setup)

Steps to reproduce:

  1. Add the following config in launch.json.
{
    "name": "Python: Current File",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "python": [
        "conda",
        "run",
        "-n",
        "base",
        "python"
    ],
    "logToFile": true
}
  1. Debug the python extension. Make sure you're in experiments DebugAdapterFactory - experiment and PtvsdWheels37 - experiment. Remove all references in the resolver to "pythonPath" as it's deprecated.
  2. Select conda as interpreter.
  3. Start debugging.

Expected behavior

Debugging works. And the command should begin with conda run -n base python ....

Actual behavior

The command:
image

Debugging fails:
image

Log files

debugger.vscode_dbc3a284-d158-4e8b-9cfc-ddd709011d6b.log
ptvsd.adapter-17808.log
ptvsd.launcher-18848.log
ptvsd.server-17816.log

Activity

  1. int19h commented on Nov 22, 2019

    @int19h
    Contributor

    I believe that this is fundamentally the same problem as #1930, the fix for which has only just went in. Can you try it with ptvsd v5.0.0a8, and see if that fixes it?

  2. int19h commented on Nov 22, 2019

    @int19h
    Contributor

    Actually, looking at the logs, I don't think even that would help. Not even the parent PID matches what we spawned:

    I+00001.203: /handling #2 request "launch" from IDE[1]/
                 Waiting for connection from debug server with PID=35692...
    
    D+00003.047: Server[?] --> {
                         ...
                         "process": {
                             "pid": 17816,
                             "ppid": 27720,
                             "executable": "C:\\Users\\karraj\\AppData\\Local\\Continuum\\anaconda3\\python.exe",
                             "bitness": 64
                         }
                     }
                 }
    

    Looking at the source code for conda run, it's because it generates a massive shell script, and then uses the shell to run that. So the chain is ptvsd.launcher -> conda -> cmd.exe -> python.exe, where the PID that the launcher has from spawning the process is that of conda, but neither the PID nor the parent PID it gets from python.exe matches that.

    So it's the same fundamental problem, but the fix for #1930 won't work. It seems that we'll have to remove PID validation entirely, and just assume that the first connection that comes in is the launched process, regardless of which PID it reports. :/

  3. added a commit that references this issue on Nov 22, 2019
    439f1d6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions