Skip to content

fix: extension uncaughtException listen Maximum call stack size exceeded#244690

Merged
jrieken merged 4 commits intomicrosoft:mainfrom
wszgrcy:precise-crane
Mar 26, 2025
Merged

fix: extension uncaughtException listen Maximum call stack size exceeded#244690
jrieken merged 4 commits intomicrosoft:mainfrom
wszgrcy:precise-crane

Conversation

@wszgrcy
Copy link
Contributor

@wszgrcy wszgrcy commented Mar 26, 2025

The problem can be abstracted into the following code

  function test(fn: any) {
    fn = () => {
      return fn();
    };
    return fn();
  }
  test(() => {
    console.log('call');
  });
RangeError: Maximum call stack size exceeded
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:7)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)
    at fn (c:\code\my-project\ts-test\error-test2.ts:5:14)

fix

global.process.on('uncaughtException',()=>{
// not work
})

Due to the reuse of variables, the extension listens for infinite recursive calls of events

@jrieken
Copy link
Member

jrieken commented Mar 26, 2025

Thanks. This is a really good find.

@jrieken jrieken enabled auto-merge March 26, 2025 08:41
@jrieken jrieken added this to the March 2025 milestone Mar 26, 2025
@jrieken jrieken merged commit 7fe436f into microsoft:main Mar 26, 2025
7 checks passed
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators May 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants