-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Exit Code 137 when a background subprocess is closed externally #11055
Labels
bug
Something isn't working
Comments
wellwelwel
changed the title
Exit Code 137 when background subprocess is closed externally
Exit Code 137 when background a subprocess is closed externally
May 14, 2024
wellwelwel
changed the title
Exit Code 137 when background a subprocess is closed externally
Exit Code 137 when a background subprocess is closed externally
May 14, 2024
robobun
added
question
Further information is requested
typescript
Something for TypeScript
transpiler
parser || printer
tracking
An umbrella issue for tracking big features
node.js
Compatibility with Node.js APIs
needs repro
Needs an example to reproduce
performance
An issue with performance
needs tests
Something that needs more testing
napi
Compatibility with the native layer of Node.js
crash
An issue that could cause a crash
web-api
Something that relates to a standard Web API
npm
Something that relates to the npm-compatible client
os
Something wrong with a specific OS
sqlite
Something to do with bun:sqlite
wasm
Something that related to WASM or WASI support
tech debt
proposal
regression
debugger
Something to do with `bun --inspect` or the debugger
vscode
Something to do with the VSCode extension
windows
An issue that only occurs on Windows
macOS
An issue that only occurs on macOS
linux
An issue that only occurs on Linux
cli
Something to do with CLI arguments
repl
An issue with `bun repl`
labels
May 15, 2024
paperdave
added
bug
Something isn't working
and removed
npm
Something that relates to the npm-compatible client
os
Something wrong with a specific OS
sqlite
Something to do with bun:sqlite
wasm
Something that related to WASM or WASI support
tech debt
proposal
regression
debugger
Something to do with `bun --inspect` or the debugger
vscode
Something to do with the VSCode extension
windows
An issue that only occurs on Windows
macOS
An issue that only occurs on macOS
linux
An issue that only occurs on Linux
cli
Something to do with CLI arguments
repl
An issue with `bun repl`
atw
docker
An issue that occurs when running in Docker
lambda
An issue related to the AWS Lambda layer
ffi
Something related with FFI in Bun
needs investigate
Needs to be investigated to find the root cause
idea
quick fix
Something that can be fixed with low effort, but high impact
shell
Something to do with Bun as a shell
types
An issue with TypeScript types
cjs
duplicate
glob
Related to Bun.Glob
sourcemaps
breaking
labels
May 15, 2024
Thanks, @paperdave 🤝 Same approach worked for Windows, using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Bun is running?
1.1.8+89d25807f
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
When a subprocess is started, but is terminated externally (e.g., using
kill -9
), Bun executes the entire script normally until its end, but terminates the process with code137
if this subprocess was previously called (usingfetch
, for example), even if it all worked properly.Steps
spawn
) that will be used in backgroundlib/server.ts
lib/pid.ts
repro.error.ts
Output
ℹ️ Note that the error is not exactly related to
fetch
itself. Even usingnode:http
or an external package, the issue seems to be related to the simple fact of Bun triggers a service running in the background.What is the expected behavior?
I tried the same approach for Deno and Node.js, and everything worked normally in all cases, as expected.
Also, in Bun, by just not calling the background subprocess, everything will work as usual:
repro.success.ts
fetch
Output
What do you see instead?
A visual output of both the error and success examples:
Additional information
I noticed that both Bun and Deno reproduce the issue #7441. To solve this in my package, I've allowed the user to pass a port when finishing a subprocess to ensure its end.
But even if the process terminates completely successfully, this happens (due to the
137
exit code — this reported issue):Thanks for your time 🙋🏻♂️
The text was updated successfully, but these errors were encountered: