bun
bun copied to clipboard
SegmentationFault in NextJS during load-testing
Description
Bun exits with a SegmentationFault error when load-testing a default NextJS project.
Steps to replicate error
- Install new/default next project using
bun create next test_proj
command in terminal. - To run app, cd into project dir and execute the
bun dev
command in terminal. - If you don't have a load-tester handy, Siege can be installed using
brew install siege
command in terminal. - Run load-test against project. eg. with siege I run the following -
siege http://localhost:3000 -c 100
Result
Application will crash with SegmentationFault at 4611686014132420608
on MacOS (M1) or SegmentationFault at 0
on WSL.
This is a bug, but I do not recommend bun dev
for load testing of any kind
bun dev
is not designed for production (hence "dev"). It's designed to be much faster than NodeJS-based dev servers, but it actually uses a completely different and much slower HTTP server than Bun.serve
This is a bug, but I do not recommend
bun dev
for load testing of any kind
bun dev
is not designed for production (hence "dev"). It's designed to be much faster than NodeJS-based dev servers, but it actually uses a completely different and much slower HTTP server thanBun.serve
Thanks for the info Jarred! Could you let me now how to run NextJS apps in Production Mode with Bun.serve
? It's not clear to me from the docs how this works currently.
My brief digging into this problem is most likely to occur when 404 occur.
$ mkdir foo
$ cd foo
$ bun dev
This always crash (for me)
$ mkdir foo
$ cd foo
$ touch index.html
$ bun dev
This does not occur. This is my guess, but the race condition may have occurred when "Connection: close" was returned.
bun dev
was changed in Bun v1.0, it will now run the "dev" script in your package.json. Because of that, this issue is no longer applicable.