Skip to content

Conversation

@bryanchen-d
Copy link
Contributor

@bryanchen-d bryanchen-d commented Jan 21, 2026

We need to capture more frames to better understand the triggering routes of unhandled errors.
Also 100 frames is consistent from with we set in bootstrap-node.ts and extensionHostMain.ts

Copilot AI review requested due to automatic review settings January 21, 2026 01:57
@bryanchen-d bryanchen-d self-assigned this Jan 21, 2026
@vs-code-engineering
Copy link

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

@bpasero

Matched files:

  • src/vs/code/browser/workbench/workbench.ts
  • src/vs/code/electron-browser/workbench/workbench.ts

@deepak1556

Matched files:

  • src/vs/code/browser/workbench/workbench.ts
  • src/vs/code/electron-browser/workbench/workbench.ts

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR increases the V8 stack trace limit from the default 10 frames to 100 frames to improve error telemetry and debugging capabilities in VS Code.

Changes:

  • Added Error.stackTraceLimit = 100 to browser and Electron workbench entry points
  • Included explanatory comments with reference to V8 Stack Trace API documentation

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/vs/code/browser/workbench/workbench.ts Sets stack trace limit to 100 at the browser workbench entry point before any imports
src/vs/code/electron-browser/workbench/workbench.ts Sets stack trace limit to 100 at the Electron workbench entry point before any imports

@deepak1556
Copy link
Collaborator

You can add it to https://github.com/microsoft/vscode/blob/main/src/vs/code/browser/workbench/workbench.html and https://github.com/microsoft/vscode/blob/main/src/vs/code/electron-browser/workbench/workbench.html instead to truly configure it at entry.

The cost of bumping this limit depends on what we do with the exceptions, so if we are fine with 100 in other processes this should be safe bump here as well.

Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a good location to put this in. If you tell me which processes should have this, we can find a better entry file.

It seems unsupported on Firefox, not sure what it means to set it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stackTraceLimit

@deepak1556
Copy link
Collaborator

Yes this is a V8 only thing, should scope it to desktop and only chrome based browsers.

@bpasero
Copy link
Member

bpasero commented Jan 21, 2026

I pushed a change to just move it into here:

private registerErrorHandler(logService: ILogService): void {

I think we likely want this for the extension host as well so we would need to add it there too.

I am not entirely sure the impact of this change for performance though.

Fun fact: I recall we had a stacktrace limit of 100 for a long time but at one point I think I just removed that, cannot recall anymore why I did that, maybe as part of adopting sandbox for the renderer and back then it was a node.js option only.

@deepak1556
Copy link
Collaborator

I think we likely want this for the extension host as well so we would need to add it there too.

Isn't it covered in

// increase number of stack frames(from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
Error.stackTraceLimit = 100;

Also not sure why we do it again in

// increase number of stack frames (from 10, https://github.com/v8/v8/wiki/Stack-Trace-API)
Error.stackTraceLimit = 100;
for extension host.. Doesn't bootstrap-node inject in all Node.js integrated processes ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants