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

Cannot launch multiple Python debug sessions using VSC API #7269

Closed
kejxu opened this issue Sep 6, 2019 · 7 comments
Closed

Cannot launch multiple Python debug sessions using VSC API #7269

kejxu opened this issue Sep 6, 2019 · 7 comments
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority

Comments

@kejxu
Copy link

kejxu commented Sep 6, 2019

Environment data

  • VS Code version: 1.37.1
  • Extension version (available under the Extensions sidebar): 2019.9.34474
  • OS and version: Win10
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A
  • Relevant/affected Python packages and their versions: N/A
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): N/A

Expected behaviour

multiple Python debug sessions get launched upon executing the following code inside an extension:

for (let request of launchRequests) {
    request.executable = request.executable.toLowerCase();
    if (request.executable.endsWith("python") || request.executable.endsWith("python.exe")) {
        const pythonScript: string = request.arguments.shift();
        const pythonlaunchdebugconfiguration: vscode.DebugConfiguration = {
            name: `Python: launch`,
            type: "python",
            request: "launch",
            program: pythonScript,
            args: request.arguments,
            env: request.env,
            stopOnEntry: true,
        };
        vscode.debug.startDebugging(undefined, pythonlaunchdebugconfiguration);
    }
}

Actual behaviour

only 1 debug session gets launched, other debug sessions would hit a timeout error like this:
image

Note

related to #6017

@kejxu kejxu added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Sep 6, 2019
@kejxu kejxu changed the title [bug] cannot multiple Python debug sessions from an extension [bug] cannot launch multiple Python debug sessions from an extension Sep 6, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Sep 9, 2019
@kimadeline
Copy link

@karthiknadig Are we going to address this as part of the new debug adapter work?

@kimadeline kimadeline self-assigned this Sep 9, 2019
@karthiknadig
Copy link
Member

Correct, but not entirely. When we tried this, there seems to be some race condition in the extension itself, where only a sub set of connections end up going through the proper debugger hand shake. and the rest are left hanging waiting for a launch/attach request.

The new adapter addresses only part of the problem.

@luabud luabud added the important Issue identified as high-priority label Sep 9, 2019
@DonJayamanne
Copy link

I'd block this issue, waiting for the new Debug Adapter work.
Else we'll end up doubling our work looking at issues in both debug adapters.

@DonJayamanne DonJayamanne changed the title [bug] cannot launch multiple Python debug sessions from an extension Cannot launch multiple Python debug sessions using VSC API Sep 11, 2019
@luabud
Copy link
Member

luabud commented Feb 27, 2020

@karthiknadig is this still an issue in debugpy?

@karthiknadig
Copy link
Member

We need to test this. It should not be a problem anymore, since we use the same mechanism as above to attach to multiple processes. The only thing that is concerning is that this is using integratedTerminal which is default. I am not sure how that impact will be when launching multiple processes.

@karthiknadig
Copy link
Member

Tested this with debugpy... I was able to launch 5 successive session using the code above:
image

This is the code I used to launch:

        ['code1.py', 'code2.py', 'code3.py', 'code4.py', 'code5.py'].forEach(f => {
            const pythonlaunchdebugconfiguration: DebugConfiguration = {
                name: `Python: launch ${f}`,
                type: 'python',
                request: 'launch',
                program: `./${f}`,
                stopOnEntry: true
            };
            this.debugService.startDebugging(undefined, pythonlaunchdebugconfiguration);
        });

@karthiknadig
Copy link
Member

Closing this, since this is now possible with debugpy. Currently debugpy is turned on for all users.

@ghost ghost removed the needs PR label Apr 3, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-debugging bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority
Projects
None yet
Development

No branches or pull requests

6 participants