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

esbuild-wasm@0.17.6 throws maximum call stack size exceeded #2911

Closed
merceyz opened this issue Feb 12, 2023 · 3 comments
Closed

esbuild-wasm@0.17.6 throws maximum call stack size exceeded #2911

merceyz opened this issue Feb 12, 2023 · 3 comments

Comments

@merceyz
Copy link

merceyz commented Feb 12, 2023

Describe the bug

Starting in esbuild-wasm@0.17.6, bundling Yarn throws the following error:

wasm://wasm/026e9252:1


RangeError: Maximum call stack size exceeded
    at wasm://wasm/026e9252:wasm-function[2854]:0x4068ce
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d
    at wasm://wasm/026e9252:wasm-function[2854]:0x40de9d

Node.js v18.14.0

To Reproduce

Try to bundle Yarn at yarnpkg/berry@76ad929

git clone --filter=tree:0 https://github.com/yarnpkg/berry
cd berry
git checkout 76ad929ed5c51fda31c5631426703ca7d16ac76f
yarn build:cli
@evanw
Copy link
Owner

evanw commented Feb 12, 2023

I suspect upgrading from Go 1.19.5 to Go 1.20.0 caused this. Go 1.20 likely uses more stack space and/or represents the stack differently than Go 1.19. I may have to revert the upgrade.

@evanw
Copy link
Owner

evanw commented Feb 13, 2023

I have investigated this. The problem is coming from this file, which has a very deeply-nested AST (>400 levels deep): https://unpkg.com/grapheme-splitter@1.0.4/index.js. So it's understandable that this is a stack overflow. Hmm.

@evanw
Copy link
Owner

evanw commented Feb 13, 2023

I'm going to try switching the affected code from recursion to iteration. Please let me know if this doesn't resolve the issue.

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

No branches or pull requests

2 participants