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

Can't debug nodemon twice #61517

Closed
roblourens opened this issue Oct 22, 2018 · 9 comments
Closed

Can't debug nodemon twice #61517

roblourens opened this issue Oct 22, 2018 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-found Issue verification failed

Comments

@roblourens
Copy link
Member

  • Debug a nodemon config like this:
{
    "type": "node",
    "request": "launch",
    "name": "nodemon",
    "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/nodemon",
    "program": "${workspaceFolder}/out/app.js",
    "restart": true,
    "console": "integratedTerminal",
    "internalConsoleOptions": "neverOpen"
},
  • Press stop
  • Start debugging again
  • "There is already a debug configuration "nodemon" running"
@isidorn
Copy link
Contributor

isidorn commented Oct 23, 2018

Thanks for the nice steps, I can reproduce it.
After debugging the problem here is that on stop the debug adapter send a onDidTerminateDebugge with the event.body.restart so we try to restart and fail which leavs the session in a bad state.

So when vscode sends a terminate or disconnect request to debug adapter the debugee exit event should not contain the restart inside the body.
Forwarding to @weinand and @roblourens to potentially fix this on the extension side.

screen shot 2018-10-23 at 16 06 26

@isidorn isidorn added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Oct 23, 2018
@isidorn isidorn assigned roblourens and weinand and unassigned isidorn Oct 23, 2018
@roblourens
Copy link
Member Author

It seems like the DA might not be handling terminate/disconnect correctly, but it works in 1.28 and nothing has changed in the DA. Did anything change with how those events are sent?

@isidorn
Copy link
Contributor

isidorn commented Oct 23, 2018

@roblourens it migth be that before we were not keeping inactive session which we do now as part of the refactoring to show multiple debug consoles.
Anyways this refactoring seems to have uncovered an issue on the adapter side. Let me know if this can not be fixed on the adapter side and if that is the case I can try to find some solution on the vscode side

@roblourens
Copy link
Member Author

Yeah I need to fix it on the DA side. But I'm confused, the terminate request doesn't seem to work in 1.28. The DA sends supportsTerminateRequest but this.raw.capabilities.supportsTerminateRequest is false in debugSession.terminate...?

@roblourens
Copy link
Member Author

Oh it works if I disable Live Share

@roblourens
Copy link
Member Author

roblourens commented Oct 23, 2018

I thought that Live Share issue was fixed? Do you know anything about that? Very frustrating when debugging this stuff.

@roblourens roblourens added this to the October 2018 milestone Oct 23, 2018
roblourens added a commit to microsoft/vscode-chrome-debug-core that referenced this issue Oct 23, 2018
@mjbvz
Copy link
Contributor

mjbvz commented Nov 9, 2018

Following the steps in the original issue, I still see this error

  1. With the debug config:
{
    "type": "node",
    "request": "launch",
    "name": "nodemon",
    "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/nodemon",
    "program": "${workspaceFolder}/out/app.js",
    "restart": true,
    "console": "integratedTerminal",
    "internalConsoleOptions": "neverOpen"
},

and app.js

console.log('hello!')
  1. Press f5 to start debugging.
  2. See debugging stop after program is run
  3. Press f5 again

I get two errors:

/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2429 Error: There is already a debug configuration "nodemon" running.
    at file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4870:754
    at n.Class.derive._oncancel.then (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:169:517)
    at file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4870:397
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

and then:

Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:43094).

@mjbvz mjbvz reopened this Nov 9, 2018
@mjbvz mjbvz modified the milestones: October 2018, November 2018 Nov 9, 2018
@mjbvz mjbvz added the verification-found Issue verification failed label Nov 9, 2018
@roblourens
Copy link
Member Author

This is a different issue when the program terminates cleanly, it's not the typical nodemon scenario, tbh I think this scenario has never worked quite right.

We can tell that nodemon is not going to restart when we get to here: https://github.com/Microsoft/vscode-node-debug2/blob/master/src/nodeDebugAdapter.ts#L307

@roblourens
Copy link
Member Author

Actually, I don't think I want to change this. You can still restart debugging if you change the program again within 10s. If you wait more than 10s, the DA times out and you can press F5 again. I am not sure how to improve this because the DA doesn't have anything to attach to when the app is not running, and we don't have UI or a concept of the DA waiting forever for nodemon to start again... I don't remember users complaining about this either, so I'm leaving it alone.

@roblourens roblourens removed this from the December/January 2019 milestone Dec 14, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-found Issue verification failed
Projects
None yet
Development

No branches or pull requests

4 participants