Open ice-chillios opened 10 months ago
same but only with --minify
I ran on debug version:
β― ../bun/build/bun-debug build node_modules/@swapkit/toolbox-cosmos/dist/index-qNhBHUBJ.js
[SYS] read(3[/Users/steve/Code/bun/build/bun-debug], 4096) = 4096 (0.067ms)
[fs] close(3[/Users/steve/Code/bun/build/bun-debug])
[SYS] openat(-2, /Users/steve/Code/bun-build-swapkit-issue/bunfig.toml) = -1
[SYS] openat(7[/Users/steve/Code/bun-build-swapkit-issue], package.json) = 8
[fs] openat(7[/Users/steve/Code/bun-build-swapkit-issue], /Users/steve/Code/bun-build-swapkit-issue/package.json) = 8
[fs] close(8[/Users/steve/Code/bun-build-swapkit-issue/package.json])
[SYS] openat(7[/Users/steve/Code/bun-build-swapkit-issue], tsconfig.json) = 8
[fs] openat(7[/Users/steve/Code/bun-build-swapkit-issue], /Users/steve/Code/bun-build-swapkit-issue/tsconfig.json) = 8
[fs] close(8[/Users/steve/Code/bun-build-swapkit-issue/tsconfig.json])
[fs] close(3[/])
[fs] close(4[/Users])
[fs] close(5[/Users/steve])
[fs] close(6[/Users/steve/Code])
[fs] close(7[/Users/steve/Code/bun-build-swapkit-issue])
[ThreadPool] 12 workers
[fs] close(4[/Users/steve/Code/bun-build-swapkit-issue/node_modules])
[SYS] openat(-2, /Users/steve/Code/bun-build-swapkit-issue/node_modules/node_modules/@swapkit/toolbox-cosmos/dist/) = -1
[SYS] openat(5[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos], package.json) = 6
[fs] openat(5[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos], /Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos/package.json) = 6
[fs] close(6[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos/package.json])
[fs] close(4[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit])
[fs] close(5[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos])
[fs] close(6[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos/dist])
[ThreadPool] Worker.create()
[SYS] openat(-2, /Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos/dist/index-qNhBHUBJ.js) = 4
[fs] openat(0, /Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos/dist/index-qNhBHUBJ.js) = 4
[ThreadPool] Worker.create()
[fs] close(4[/Users/steve/Code/bun-build-swapkit-issue/node_modules/@swapkit/toolbox-cosmos/dist/index-qNhBHUBJ.js])
[Bundle] onParse(0, runtime) = 0 imports, 22 exports
[1] 30061 illegal hardware instruction ../bun/build/bun-debug build
Looks like problem in parsing the ASMJS version of libsodium.
File node_modules/@swapkit/toolbox-cosmos/dist/index-qNhBHUBJ.js
and line #20000
The subexpressions are well over 100 deep, making the stack at least 4x that.
Yeah, looks like stack overflow due to recursion. We will need to experiment with decreasing the amount of recursion/memory needed for parseExpr/Suffix/Prefix
or experiment with increasing stack size for parser threads
What version of Bun is running?
1.0.18 (retested with 1.0.29 with no success)
What platform is your computer?
Darwin 23.2.0 arm64 arm
What steps can reproduce the bug?
bun install
.bun build
on one of the cases in code -> it crashes.bun run index.ts
in case with "Cosmos" chain -> it also crashes in this caseWhat is the expected behavior?
Pass and bundle code properly
What do you see instead?
Crash with
illegal hardware instruction
errorAdditional information
Hi π I'm co-creator of some crypto oss project and as we wanted to switch to bun in some use-cases like build and release pipeline we've met a few issues with building and sometimes running code via bun.
Here's repo with reproduction and additional comments but I'm happy debug it further more if only I could get any help in case of deeper debugging as I couldn't find anything useful with
--inspect
on my own - it just crashes whenever reaches some part of code.Additional stuff what I found that might be useful is:
bun build --no-bundle index.ts
works but ofc it's not sth that works πbun run
in both cases - but stillbuild
crashedP.S. Current setup of
@swapkit
packages is bundled, build by vite and split into cjs & esm. I've tried switch tobun
but got the same crash on some packages so I assume that there is some issue there but I can't figure it out or how to dig further beyond Bun built-in debug tools.