Open frankhinek opened 5 months ago
Still having this issue, causing slow restarts in production.
Still having this issue, causing slow restarts in production.
Maybe this isn't related. I found my problem was not setting preset in nuxt properly. After doing this it restarts fast.
nitro: {
preset: 'bun'
},
Closing here then. Also, building with bun should set the correct preset (but otherwise nitro can't detect it during build).
(reopen until investigate better. we should auto detect bun but seems we don't)
@pi0 How should bun be detected when the build didn't happen with bun? Runtime detection?
That's another topic for nitro v3 maybe (server will be multi-runtime ;) but in src/preset we should auto detect Bun.
Also Bun, should work in Node.js compat mode, it might be an upstream Bun issue we need to report it.
Environment
Reproduction
Validate that, when built with the
node-server
preset, theclose
hook runs as expected under both Node.js and Bun runtimes:Install and build using the default
node-server
preset:Run the Nitro server with
node
:Press Ctrl + C to send
SIGINT
to the process and observe the expected output:Run the Nitro server with
bun
:Press Ctrl + C to send
SIGINT
to the process and observe the expected output:The
close
hook runs whether the runtime isnode
orbun
given that the build used thenode-server
preset.Reproduce that the
close
hook fails to run when built with thebun
preset.Remove the
.nitro
and.output
directories:Build using the
bun
preset:Run the Nitro server:
SIGINT
to the process and observe the output:The code specified in the
close
hook never runs.Describe the bug
When using the Nitro web server built with the
bun
preset, theclose
hook fails to run upon receiving a SIGINT signal (Ctrl + C). This behavior contrasts with the expected functionality observed when using thenode-server
preset, where theclose
hook executes properly under both Node.js and Bun runtimes.Specifically, when built with the
node-server
preset, pressing Ctrl + C results in the expected output:However, when built with the
bun
preset and run using Bun, pressing Ctrl + C simply terminates the process without executing theclose
hook, resulting in no output.This issue prevents proper graceful shutdown procedures from being executed when using the
bun
preset, which could lead to resource leaks or incomplete cleanup operations in production environments.Note: The root cause of this issue has not been isolated, and therefore, I am unable to submit a pull request with a fix at this time.
Additional context
No response
Logs
No response