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

thread 'main' has overflowed its stack using Deno bundle (Windows) #9752

Closed
dragonstyle opened this issue Mar 10, 2021 · 12 comments
Closed

thread 'main' has overflowed its stack using Deno bundle (Windows) #9752

dragonstyle opened this issue Mar 10, 2021 · 12 comments
Labels
bug Something isn't working correctly fix available there is a fix available in a third party library that needs to be merged swc related to swc (bundling/transpiling)
Milestone

Comments

@dragonstyle
Copy link

When running deno bundle on Windows: deno bundle --unstable --importmap=src/import_map.json src/quarto.ts package/dist/bin/quarto.js I receive the error

thread 'main' has overflowed its stack

and bundling fails. The same command succeeds on macos/posix platforms. The error appeared starting in Deno v1.8.0 and persists in v1.8.1. We were previously using v1.7.5 without issue.

I suspect the issue may be related to a circular dependency with the following modules:

DEBUG RS - swc_bundler::bundler::load:83 - (ModuleId(54), #572, #573) Storing module: 
<https://deno.land/std@0.90.0/path/mod.ts>
DEBUG RS - swc_bundler::bundler::load:83 - (ModuleId(66), #596, #597) Storing module: 
<https://deno.land/std@0.90.0/path/glob.ts>

because the debug information for windows is full of:

DEBUG RS - swc_bundler::bundler::chunk::plan:618 - Circular dep: ModuleId(54) => ModuleId(66)
DEBUG RS - swc_bundler::bundler::chunk::plan:618 - Circular dep: ModuleId(54) => ModuleId(66)
DEBUG RS - swc_bundler::bundler::chunk::plan:618 - Circular dep: ModuleId(54) => ModuleId(66)
DEBUG RS - swc_bundler::bundler::chunk::plan:618 - Circular dep: ModuleId(54) => ModuleId(66)

I've attached the debug output for the bundle command as well as the deno info for the module:

Info -- Json
Bundle -- Debug Output

I haven't been able to create a standalone repro case outside of our module. Is there other information that I can provide to be helpful?

@kitsonk kitsonk added bug Something isn't working correctly swc related to swc (bundling/transpiling) labels Mar 10, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Mar 10, 2021

cc/ @kdy1

@kdy1
Copy link

kdy1 commented Mar 11, 2021

Log for circular imports are not related to stack overflow.
Can you run it again with RUST_MIN_STACK (environment variable) set to 8388608?

@dragonstyle
Copy link
Author

Just ran it again after setting that env variable and it didn't appear to make a difference. Same thread 'main' has overflowed its stack error.

bundle.debug.txt

@kdy1
Copy link

kdy1 commented Mar 11, 2021

@dragonstyle Thanks!

@kdy1
Copy link

kdy1 commented Mar 20, 2021

It works on my machine if I set RUST_MIN_STACK as 8388608

kdy1 added a commit to kdy1/swc that referenced this issue Mar 20, 2021
@dragonstyle
Copy link
Author

Perhaps I'm not setting the stack size correctly - here is the simple case I'm using

C:\Users\charlesteague\Development\quarto-cli\package\src>C:\Users\charlesteague\Development\quarto-cli\package\dist\bin\deno --version
deno 1.8.1 (release, x86_64-pc-windows-msvc)
v8 9.0.257.3
typescript 4.2.2

C:\Users\charlesteague\Development\quarto-cli\package\src>set RUST_MIN_STACK=8388608

C:\Users\charlesteague\Development\quarto-cli\package\src>echo %RUST_MIN_STACK%
8388608

C:\Users\charlesteague\Development\quarto-cli\package\src>C:\Users\charlesteague\Development\quarto-cli\package\dist\bin\deno bundle --unstable --importmap=C:\Users\charlesteague\Development\quarto-cli\src\import_map.json C:\Users\charlesteague\Development\quarto-cli\src\quarto.ts C:\Users\charlesteague\Development\quarto-cli\package\dist\bin\quarto.js
Bundle file:///C:/Users/charlesteague/Development/quarto-cli/src/quarto.ts
Check file:///C:/Users/charlesteague/Development/quarto-cli/src/quarto.ts

thread 'main' has overflowed its stack

C:\Users\charlesteague\Development\quarto-cli\package\src>

kdy1 added a commit to swc-project/swc that referenced this issue Mar 22, 2021
bundler:
 - Prevent stack overflow. (denoland/deno#9752)

testing:
 - Bump version
 - Fix handling of paths on windows.

testing_macros:
 - Bump version
 - Correctly ignore files.
@kdy1
Copy link

kdy1 commented Mar 23, 2021

Fixed on upstream

@kitsonk kitsonk added the fix available there is a fix available in a third party library that needs to be merged label Mar 23, 2021
kdy1 added a commit to kdy1/swc that referenced this issue Mar 31, 2021
bundler:
 - Prevent stack overflow. (denoland/deno#9752)

testing:
 - Bump version
 - Fix handling of paths on windows.

testing_macros:
 - Bump version
 - Correctly ignore files.
@dragonstyle
Copy link
Author

@kdy1 Thanks so much for fixing this promptly. @kitsonk I'm not sure how to tell when to expect this in a Deno release- can you give me any guidance (e.g. will it just get included in the next release now that the fix is available)?

Been really enjoying working with Deno- thank both of you for all your work on it!

@kitsonk kitsonk added this to the 1.9.0 milestone Apr 6, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Apr 6, 2021

Should be in Deno 1.9 (next week).

@bartlomieju
Copy link
Member

Fixed in 1.9.0

@dragonstyle
Copy link
Author

Confirmed- we are back in business on 1.9. Thank you!

@StoneCypher
Copy link

Respectfully, @bartlomieju , I believe I have found another instance of this fault in #15117. I cannot be certain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly fix available there is a fix available in a third party library that needs to be merged swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

5 participants