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

Debug: Debugging VS Code breaks down #83994

Closed
joaomoreno opened this issue Nov 5, 2019 · 13 comments
Closed

Debug: Debugging VS Code breaks down #83994

joaomoreno opened this issue Nov 5, 2019 · 13 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster

Comments

@joaomoreno
Copy link
Member

joaomoreno commented Nov 5, 2019

I've just hit a scenario in which debugging VS Code stops working all of a sudden and breaks down UI.

Sorry for the complicated repro steps, but I can't seem to narrow it down more than this:

Repro

  1. Create an empty test folder. Then, inside create a file grandfather/father/son.txt, creating the respective folders.
  2. Check out vscode 9a7d52b769d82d413422fbd5cec3dbaa21a08b2b and start yarn watch.
  3. Start debugging and open the folder created in the first step.
  4. Expand grandfather, you should now see a compressed grandfather/father folder along with one son.txt child.
  5. Press Explorer Refresh action until grandfather collapses.
  6. Put a breakpoint in asyncDataTree.ts#647
  7. Expand grandfather. You'll hit the breakpoint and 🐛
  • Notice the variables view is either empty or endlessly loading
  • None of the debug actions work any more: play, stop, continue, etc

I am force to killall code-oss and restart debugging. I can repro this 100% of the time.

I've showed this to @weinand. We tried getting output which would lead us to the problem using the trace option, but that didn't help much. He suggested to try to reproduce in the integrated Chrome DevTools and it does not reproduce.

cc @isidorn

@weinand
Copy link
Contributor

weinand commented Nov 5, 2019

... and after replacing the "await" with a promise:

2019-11-05_17-34-14
the problem disappeared...

@weinand weinand added the debug Debug viewlet, configurations, breakpoints, adapter issues label Nov 5, 2019
@roblourens
Copy link
Member

Are you sure there isn't anything interesting in the log? If you are still set up to repro this, can you share it?

@joaomoreno
Copy link
Member Author

@roblourens I've simplified the repro steps. I've sent you the log via Slack.

@roblourens
Copy link
Member

Thanks. It looks like electron just stopped responding, and it doesn't look like the DA did anything weird. I'll try to see if there's anything we can do about it though.

@roblourens
Copy link
Member

This is really weird. I see it 100% of the time here but there is nothing unusual about this code. It doesn't repro just in Chrome with the web UI. It still reproes in Electron 7.

@deepak1556 any idea?

@deepak1556
Copy link
Contributor

Observing the same as @roblourens https://streamable.com/zwsw1 , electron render is actually crashing here. I will investigate further.

@deepak1556
Copy link
Contributor

deepak1556 commented Nov 23, 2019

Using debug version of electron gave the following trace when the hang happens

abort: CSA_ASSERT failed: IntPtrGreaterThanOrEqual(case_value, IntPtrConstant(0)) [./../../v8/src/interpreter/interpreter-generator.cc:3230]


==== JS stack trace =========================================

    0: ExitFrame [pc: 0x10733f580]
    1: StubFrame [pc: 0x10750ae2a]
Security context: 0x002c504d3931 <String[#7]: file://>
    2: refreshAndRenderNode [0x2ca5ab4bc1] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/asyncDataTree.js:1] [bytecode=0x2c9143f0a9 offset=0](this=0x002cacd44361 <AsyncDataTree map = 0x2cf5367379>#0#,0x002c2abc04d1 <undefined>,0x002c2abc04d1 <undefined>,0x002c2abc04d1 <undefined>)
    3: /* anonymous */ [0x2c4e256e09](this=0x002ca1a01c09 <JSGlobal Object>#1#,0x002c2abc04d1 <undefined>)
    4: StubFrame [pc: 0x10726028b]
    5: StubFrame [pc: 0x10714e9ba]
    6: EntryFrame [pc: 0x1070c1cf8]
    7: ExitFrame [pc: 0x10733fc40]
    8: StubFrame [pc: 0x1074a263e]
    9: refreshAndRenderNode [0x2ca5ab4bc1] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/asyncDataTree.js:434] [bytecode=0x2c9143f0a9 offset=52](this=0x002cacd44361 <AsyncDataTree map = 0x2cf5367379>#0#,0x002c07d67521 <Object map = 0x2cf537c9a9>#2#,0x002c2abc0709 <false>,0x002c2abc04d1 <undefined>)
   10: _onDidChangeCollapseState [0x2ca5ab4e99] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/asyncDataTree.js:522] [bytecode=0x2caaa86eb9 offset=88](this=0x002cacd44361 <AsyncDataTree map = 0x2cf5367379>#0#,0x002c4e240a71 <Object map = 0x2cfd6d6259>#3#)
   11: fire [0x2c0dd61189] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:461] [bytecode=0x2cabb8bba1 offset=420](this=0x002caecb3829 <Emitter map = 0x2ca325b489>#4#,0x002c4e240a71 <Object map = 0x2cfd6d6259>#3#)
   12: /* anonymous */(aka /* anonymous */) [0x2caecb2d81] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:43] [bytecode=0x2c71f7ca99 offset=31](this=0x002c2abc01d9 <null>,0x002cf733c279 <Object map = 0x2cfd6d6259>#5#)
   13: /* anonymous */(aka /* anonymous */) [0x2cf733c7d9] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:646] [bytecode=0x2c71f5b5b9 offset=23](this=0x002c2abc04d1 <undefined>)
   14: /* anonymous */(aka /* anonymous */) [0x2cf733cac1] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:659] [bytecode=0x2c71f5b489 offset=1](this=0x002c2abc04d1 <undefined>,0x002cf733c7d9 <JSFunction (sfi = 0x2c6477d779)>#6#)
   15: forEach [0x2c42d97459](this=0x002cf733bd89 <JSArray[2]>#7#,0x002cf733cac1 <JSFunction (sfi = 0x2c6477a2b9)>#8#)
   16: bufferEvents [0x2cd22700b1] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:659] [bytecode=0x2c53778a99 offset=55](this=0x002c09ff5181 <EventBufferer map = 0x2ca47306f9>#9#,0x002cf733bd39 <JSFunction (sfi = 0x2c7ab7b6a1)>#10#)
   17: setCollapsed [0x2c405cd909] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/indexTreeModel.js:149] [bytecode=0x2c53778829 offset=98](this=0x002c66fc0309 <IndexTreeModel map = 0x2cf5356a79>#11#,0x002cf733b841 <JSArray[6]>#12#,0x002c2abc0709 <false>,0x002c2abc0709 <false>)
   18: setCollapsed [0x2cd9a9a5d1] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/objectTreeModel.js:137] [bytecode=0x2c53778369 offset=35](this=0x002cfaffeba9 <ObjectTreeModel map = 0x2cf5366889>#13#,0x002c07d67559 <Object map = 0x2cfd6d1a29>#14#,0x002c2abc04d1 <undefined>,0x002c2abc0709 <false>)
   19: setCollapsed [0x2cd9a9ab11] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/compressedObjectTreeModel.js:197] [bytecode=0x2c53777f71 offset=35](this=0x002cfaff7eb1 <CompressedObjectTreeModel map = 0x2cf5366929>#15#,0x002c07d67521 <Object map = 0x2cf537c9a9>#2#,0x002c2abc04d1 <undefined>,0x002c2abc0709 <false>)
   20: setCollapsed [0x2c10b94471] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/compressedObjectTreeModel.js:335] [bytecode=0x2c53777dc9 offset=22](this=0x002cfaff6ca1 <CompressibleObjectTreeModel map = 0x2cf5366979>#16#,0x002c07d67521 <Object map = 0x2cf537c9a9>#2#,0x002c2abc04d1 <undefined>,0x002c2abc0709 <false>)
   21: onPointer [0x2cd9a9fb39] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/ui/tree/abstractTree.js:822] [bytecode=0x2caaa91e29 offset=390](this=0x002cfaff69d1 <MouseController map = 0x2cf5366339>#17#,0x002cf733b3d1 <Object map = 0x2c1dd22a59>#18#)
   22: fire [0x2c0dd61189] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:461] [bytecode=0x2cabb8bba1 offset=420](this=0x002c7155b6d1 <Emitter map = 0x2ca325b489>#19#,0x002cf733b3d1 <Object map = 0x2c1dd22a59>#18#)
   23: /* anonymous */(aka /* anonymous */) [0x2c71563351] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:43] [bytecode=0x2c71f7ca99 offset=31](this=0x002c2abc04d1 <undefined>,0x002cf733b171 <MouseEvent map = 0x2cf537f659>#20#)
   24: fire [0x2c0dd61189] [file:///Users/demohan/github/vscode-vnext/out/vs/base/common/event.js:~443] [pc=0x1256a0f711](this=0x002c7155b709 <Emitter map = 0x2ca325b489>#21#,0x002cf733b171 <MouseEvent map = 0x2cf537f659>#20#)
   25: fn [0x2ca0948ff9] [file:///Users/demohan/github/vscode-vnext/out/vs/base/browser/event.js:9] [bytecode=0x2c91423f79 offset=13](this=0x002ca0948a11 <HTMLDivElement map = 0x2c61c8f639>#22#,0x002cf733b171 <MouseEvent map = 0x2cf537f659>#20#)
   26: InternalFrame [pc: 0x1070c1d9d]
   27: EntryFrame [pc: 0x1070c1b78]

Not sure why the same code wouldn't cause an issue in chrome, have to reduce the sample test to ask v8 folks.

@deepak1556
Copy link
Contributor

One other thing I tried was to load the web version in a basic electron app and it didn't crash there. The only difference I can notice here is that in desktop version source maps are employed to help debug the typescript file directly whereas its not the case in web version.

@deepak1556 deepak1556 self-assigned this Nov 23, 2019
@roblourens
Copy link
Member

roblourens commented Nov 24, 2019

Thanks @deepak1556, I was able to reduce it to code like this added somewhere in vscode:

class Foo {
	constructor() {
		document.body.addEventListener('click', () => {
			this.foo();
		});
	}

	async foo() {
		await this.foo2();
		await this.foo2();
	}

	async foo2() {
		return Promise.resolve();
	}
}

new Foo();

And the same thing happens with a bp on the first line of foo. Didn't repro in a simple electron app. Seems you need a click handler + native async class method + something else from vscode.

@deepak1556
Copy link
Contributor

In the above example Promise.resolve() seems to trigger the crash, is there any way we override the Promise implementation in vscode ? This might most likely be causing the same issue as the one referenced in electron/electron#20925 , I will try with electron-7.0.x branch which has this fix.

@deepak1556 deepak1556 added upstream Issue identified as 'upstream' component related (exists outside of VS Code) electron Issues and items related to Electron labels Nov 26, 2019
@deepak1556
Copy link
Contributor

deepak1556 commented Nov 26, 2019

Ignore my above theory about global promise pollution, upstream issue raised here has the details electron/electron#21288

@deepak1556
Copy link
Contributor

The upstream issue no longer repos with electron 11 and higher. Please check if this is still an issue with latest stable.

@deepak1556 deepak1556 added freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster and removed electron Issues and items related to Electron upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream labels Mar 12, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

5 participants
@joaomoreno @roblourens @deepak1556 @weinand and others