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 no longer break in node internals files #59430

Closed
roblourens opened this issue Sep 26, 2018 · 7 comments
Closed

Can no longer break in node internals files #59430

roblourens opened this issue Sep 26, 2018 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@roblourens
Copy link
Member

roblourens commented Sep 26, 2018

  • Debug, break in a node internals file
    • Easy way to repro, start debugging vscode and break on "all exceptions", break in fs.js with some random exception
  • "Cannot set property 'available' of undefined"

I think because the uri path is <node_internals>/fs.js, and we try to parse that as a uri.

Stack parsing non-uri as a uri:

(anonymous) (uri.ts:30)
e (uri.ts:173)
t (uri.ts:388)
e.parse (uri.ts:270)
(anonymous) (mainThreadDebugService.ts:303)
(anonymous) (debugUtils.ts:75)
i (debugUtils.ts:116)
t.convertToDAPaths (debugUtils.ts:73)
t.sendMessage (mainThreadDebugService.ts:299)
e.internalSend (debugAdapter.ts:158)
e.sendRequest (debugAdapter.ts:99)
(anonymous) (rawDebugSession.ts:512)
n.Class.derive._oncancel (winjs.base.js:1662)
t.send (rawDebugSession.ts:511)
t.source (rawDebugSession.ts:369)
e.loadSource (debugSession.ts:434)
e.provideTextContent (debugContentProvider.ts:65)
(anonymous) (textModelResolverService.ts:85)
o (async.ts:402)
t.first (async.ts:414)
t.resolveTextModelContent (textModelResolverService.ts:87)
t.createReferencedObject (textModelResolverService.ts:40)
e.acquire (lifecycle.ts:79)
e._createModelReference (textModelResolverService.ts:133)
e.createModelReference (textModelResolverService.ts:112)
t.resolve (resourceEditorInput.ts:87)
(anonymous) (textResourceEditor.ts:66)
then (winjs.base.js:1587)
t.setInput (textResourceEditor.ts:65)
t.doSetInput (editorControl.ts:177)
t.openEditor (editorControl.ts:69)
t.doShowEditor (editorGroupView.ts:780)
t.doOpenEditor (editorGroupView.ts:770)
t.openEditor (editorGroupView.ts:739)
t.doOpenEditor (editorService.ts:249)
t.openEditor (editorService.ts:242)
e.openInEditor (debugSource.ts:81)
e.openInEditor (debugModel.ts:390)
e.tryToAutoFocusStackFrame (debugService.ts:743)
(anonymous) (debugSession.ts:592)
g (winjs.base.js:1191)
enter (winjs.base.js:867)
_run (winjs.base.js:1089)
_completed (winjs.base.js:1057)
(anonymous) (rawDebugSession.ts:514)
e.acceptMessage (debugAdapter.ts:146)
e.$acceptDAMessage (mainThreadDebugService.ts:221)
t._doInvokeHandler (rpcProtocol.ts:442)
t._invokeHandler (rpcProtocol.ts:427)
t._receiveRequest (rpcProtocol.ts:344)
t._receiveOneMessage (rpcProtocol.ts:274)
(anonymous) (rpcProtocol.ts:149)
e.fire (event.ts:140)
a (ipc.net.ts:105)
n._socketDataListener (ipc.net.ts:134)
emitOne (events.js:116)
emit (events.js:211)
addChunk (_stream_readable.js:263)
readableAddChunk (_stream_readable.js:250)
Readable.push (_stream_readable.js:208)
onread (net.js:594)

Stack that throws the above error:

(anonymous) (debugModel.ts:1098)
e.sourceIsNotAvailable (debugModel.ts:1098)
e.sourceIsNotAvailable (debugService.ts:195)
a (debugContentProvider.ts:60)
(anonymous) (debugContentProvider.ts:74)
then (winjs.base.js:1457)
e.provideTextContent (debugContentProvider.ts:65)
(anonymous) (textModelResolverService.ts:85)
o (async.ts:402)
t.first (async.ts:414)
t.resolveTextModelContent (textModelResolverService.ts:87)
t.createReferencedObject (textModelResolverService.ts:40)
e.acquire (lifecycle.ts:79)
e._createModelReference (textModelResolverService.ts:133)
e.createModelReference (textModelResolverService.ts:112)
t.resolve (resourceEditorInput.ts:87)
(anonymous) (textResourceEditor.ts:66)
then (winjs.base.js:1587)
t.setInput (textResourceEditor.ts:65)
t.doSetInput (editorControl.ts:177)
t.openEditor (editorControl.ts:69)
t.doShowEditor (editorGroupView.ts:780)
t.doOpenEditor (editorGroupView.ts:770)
t.openEditor (editorGroupView.ts:739)
t.doOpenEditor (editorService.ts:249)
t.openEditor (editorService.ts:242)
e.openInEditor (debugSource.ts:81)
e.openInEditor (debugModel.ts:390)
e.tryToAutoFocusStackFrame (debugService.ts:743)
(anonymous) (debugSession.ts:592)
g (winjs.base.js:1191)
enter (winjs.base.js:867)
_run (winjs.base.js:1089)
_completed (winjs.base.js:1057)
(anonymous) (rawDebugSession.ts:514)
e.acceptMessage (debugAdapter.ts:146)
e.$acceptDAMessage (mainThreadDebugService.ts:221)
t._doInvokeHandler (rpcProtocol.ts:442)
t._invokeHandler (rpcProtocol.ts:427)
t._receiveRequest (rpcProtocol.ts:344)
t._receiveOneMessage (rpcProtocol.ts:274)
(anonymous) (rpcProtocol.ts:149)
e.fire (event.ts:140)
a (ipc.net.ts:105)
n._socketDataListener (ipc.net.ts:134)
emitOne (events.js:116)
emit (events.js:211)
addChunk (_stream_readable.js:263)
readableAddChunk (_stream_readable.js:250)
Readable.push (_stream_readable.js:208)
onread (net.js:594)
@roblourens roblourens changed the title Can't debug node internals files Can no longer break in node internals files Sep 26, 2018
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues bug Issue identified by VS Code Team member as probable bug labels Sep 26, 2018
@isidorn
Copy link
Contributor

isidorn commented Sep 26, 2018

This works great for me
screen shot 2018-09-26 at 11 54 30
However looking at the source code it can happen that we want to set one DebugSource as unavailable and it is only available in one of the sessions, not all. So I put a null guard to prevent this.
Note that this could fix your issue only if you are in a multi debug session

In case you still see the issue, please break on exception and verify for which exact URI does he try to get here and what is the state of the source map

@isidorn isidorn added this to the September 2018 milestone Sep 26, 2018
@roblourens
Copy link
Member Author

I don't know whether I'm mixing two issues here? But there is still an issue, maybe I'm just getting to this point now that the NPE is fixed. I realized you have to have a DebugAdapterTracker installed for this one

image

Better repro steps:

  • Install DebugAdapterTracker
  • Break on "All exceptions"
  • Debug this node script: require('fs').readFile('sldkfjsdl');
  • See error message in the content for fs.js

@roblourens roblourens reopened this Sep 26, 2018
@isidorn
Copy link
Contributor

isidorn commented Sep 27, 2018

@roblourens Can you please put a breakpoint here and figure out how he gets to construct a uri without a scheme. Basically what is the path that is passed to uri.parse

How do I install a DebugAdapterTracker? Is there an example somewhere?

@isidorn isidorn modified the milestones: September 2018, October 2018 Sep 27, 2018
@isidorn isidorn added the info-needed Issue requires more information from poster label Sep 27, 2018
@roblourens
Copy link
Member Author

You can set up the example from #59110, I pasted the stack above already

@isidorn
Copy link
Contributor

isidorn commented Oct 2, 2018

Can not repro even with a DebugAdapterTracker.
@roblourens if you can still repro can you answer my question from #59430 (comment)

screen shot 2018-10-02 at 16 36 06

@roblourens
Copy link
Member Author

roblourens commented Oct 3, 2018

I still repro with the above steps.

That line isn't where the uri is parsed, the original stack that I posted it still the issue.

image

This is at

(anonymous) (mainThreadDebugService.ts:303)
(anonymous) (debugUtils.ts:75)
i (debugUtils.ts:116)
t.convertToDAPaths (debugUtils.ts:73)
t.sendMessage (mainThreadDebugService.ts:299)
e.internalSend (debugAdapter.ts:158)
e.sendRequest (debugAdapter.ts:99)
(anonymous) (rawDebugSession.ts:512)
n.Class.derive._oncancel (winjs.base.js:1662)
t.send (rawDebugSession.ts:511)
t.source (rawDebugSession.ts:369)
e.loadSource (debugSession.ts:434)
e.provideTextContent (debugContentProvider.ts:65)
(anonymous) (textModelResolverService.ts:85)
o (async.ts:402)
t.first (async.ts:414)
t.resolveTextModelContent (textModelResolverService.ts:87)
t.createReferencedObject (textModelResolverService.ts:40)
e.acquire (lifecycle.ts:79)
e._createModelReference (textModelResolverService.ts:133)
e.createModelReference (textModelResolverService.ts:112)
t.resolve (resourceEditorInput.ts:87)
(anonymous) (textResourceEditor.ts:66)
then (winjs.base.js:1587)
t.setInput (textResourceEditor.ts:65)
t.doSetInput (editorControl.ts:177)
t.openEditor (editorControl.ts:69)
t.doShowEditor (editorGroupView.ts:780)
t.doOpenEditor (editorGroupView.ts:770)
t.openEditor (editorGroupView.ts:739)
t.doOpenEditor (editorService.ts:249)
t.openEditor (editorService.ts:242)
e.openInEditor (debugSource.ts:81)
e.openInEditor (debugModel.ts:390)
e.tryToAutoFocusStackFrame (debugService.ts:753)
(anonymous) (debugSession.ts:592)
g (winjs.base.js:1191)
enter (winjs.base.js:867)
_run (winjs.base.js:1089)
_completed (winjs.base.js:1057)
(anonymous) (rawDebugSession.ts:514)
e.acceptMessage (debugAdapter.ts:146)
e.$acceptDAMessage (mainThreadDebugService.ts:221)
t._doInvokeHandler (rpcProtocol.ts:442)
t._invokeHandler (rpcProtocol.ts:427)
t._receiveRequest (rpcProtocol.ts:344)
t._receiveOneMessage (rpcProtocol.ts:274)
(anonymous) (rpcProtocol.ts:149)
e.fire (event.ts:140)
a (ipc.net.ts:105)
n._socketDataListener (ipc.net.ts:134)
emitOne (events.js:116)
emit (events.js:211)
addChunk (_stream_readable.js:263)
readableAddChunk (_stream_readable.js:250)
Readable.push (_stream_readable.js:208)
onread (net.js:594)

@isidorn
Copy link
Contributor

isidorn commented Oct 4, 2018

@roblourens great, thanks for the clarification and the nice picture.
The issue was as you already speculated is that we were converting paths to uris without a scheme. Now I simply added a debug scheme to these path such that uri is parsed correctly. This is basically the same what we do here

@weinand please code review once you have the chance

@isidorn isidorn removed the info-needed Issue requires more information from poster label Oct 4, 2018
@isidorn isidorn closed this as completed in 84f1d0d Oct 4, 2018
@mjbvz mjbvz added the verified Verification succeeded label Nov 1, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2018
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 verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants