Repository navigation
Closed
Labels
*out-of-scopePosted issue is not in scope of VS CodebugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issuesverification-foundIssue verification failed
Description
- Use this program test.js:
let i = 0; setInterval(() => { console.log('hello: ' + i++); }, 1000);
- download current Electron, e.g. on macOS https://github.com/electron/electron/releases/download/v1.4.15/electron-v1.4.15-darwin-x64.zip
- run from command line with
./Electron.app/Contents/MacOS/Electron --debug=6009 test.js - attach VS Code with this config:
{ "type": "node", "request": "attach", "name": "Attach to Process", "address": "localhost", "port": 6009, "protocol": "legacy" }
Observe: a debug session starts and if you set a breakpoint the program will stop and hit the breakpoint.
- stop session
- change
protocoltoauto - attach VS Code again
Observe: a message "Debugging with legacy protocol because Node version could not be determined." shows up in the debug console but no debug session starts.
Turning on tracing sends this to the debug console:
Debugging with legacy protocol because Node version could not be determined.
62796: _attach: address: 127.0.0.1 port: 6009
62796: _attach: connected
62796: _terminated: socket end
62796: _terminated: node v8protocol close
62796: _terminated: socket error
62796: _terminated: node v8protocol error
62796: _terminated: node v8protocol error
62796: disconnectRequest: send responseSo it looks like that the probing leaves the debug port in a strange state which prevents node-debug from connecting to that port successfully.
When using 'node' instead of 'Electron', VS Code attaches successfully.
Trace output in this case:
Debugging with legacy protocol because Node version could not be determined.
62843: _attach: address: 127.0.0.1 port: 6009
62843: _attach: connected
62843: _initialize: got process id 62839 from node
62843: _injectDebuggerExtensions: frame based code injection failed with error 'No frames'
62843: _injectDebuggerExtensions: global code injection successful
62843: _startInitialize: stopped: false
62843: _startInitialize: no entry event after 10 retries; giving up
62843: _startInitialize2: fire initialized event
62843: _startInitialize2: in attach mode we guess stopOnEntry flag to be 'false''
62843: _startInitialize2: remember to do a 'Continue' later
62843: setFunctionBreakPointsRequest: result []
62843: setExceptionBreakPointsRequest: ["uncaught"]
62843: configurationDoneRequest: do a 'Continue'Metadata
Metadata
Assignees
Labels
*out-of-scopePosted issue is not in scope of VS CodebugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issuesverification-foundIssue verification failed
Activity
roblourens commentedon Feb 9, 2017
This is interesting, I can repro it just by using a web browser too.
"protocol": "legacy"http://localhost:6009So Electron is listening to http requests on that port too.
roblourens commentedon Feb 9, 2017
Oh, it just thinks the request is from a debugger. Then it probably thinks it's already attached and doesn't want to talk to a second debugger.
roblourens commentedon Feb 9, 2017
I see that message is still sent again when the debugger connects. It just closes the socket after sending that message. And looking at the code - https://github.com/electron/electron/blob/22b21d04bdbb43be52a90a3b05fdbd9b4278feea/atom/browser/node_debugger.cc#L148 - it looks like it wouldn't send the message again if it thought it was already attached to a debugger. I don't see anything here that explains why it's closing the socket.
roblourens commentedon Feb 15, 2017
I can't figure it out. I'd have to build Chromium to investigate deeper. A couple options:
and is closed. And I can then attach with node2.
Do you think this is safe?
Detect legacy protocol instead of detecting inspector protocol as a p…
roblourens commentedon Feb 16, 2017
My PR implements the first option. It actually doesn't work for Electron right now - it gives the same problem as above when the debug adapter attaches. But I can't figure out why, because it's doing exactly the same thing to disconnect as the debug adapter, which has no problem connecting and disconnecting to electron multiple times. I must be missing a step.
weinand commentedon Feb 16, 2017
roblourens since the PR doesn't help with Electron, I suggest that we do not "rush" this and investigate more in the next milestone.
Detect legacy protocol instead of detecting inspector protocol as a p…
roblourens commentedon Mar 27, 2017
Fixed: microsoft/vscode-node-debug@921b313
michelkaporin commentedon Mar 31, 2017
Trying to verify it, steps described by Andre Weinand (@weinand) still result in "Debugging with legacy protocol because Node version could not be determined" message without no subsequent debugger attaching. In fact, it does not attach simply in
autosetting forprotocolat all.weinand commentedon Mar 31, 2017
Not critical since our Electron launch configuration snippet sets the protocol to 'legacy' explicitly.
roblourens commentedon Apr 4, 2017
I did find a mistake in my code, but even fixing that, I get the same result. Really weird. But it does work with Electron 1.5-1.6 regardless at least. I'll debug some more since this is definitely possible.
roblourens commentedon Sep 12, 2018
Not concerned about this anymore
vscodebot commentedon Sep 12, 2018
This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.
If you wonder what we are up to, please see our roadmap and issue reporting guidelines.
Thanks for your understanding and happy coding!