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

Different exit code for SIGKILL'ed processes with Spring #676

Open
noizwaves opened this issue May 20, 2022 · 0 comments
Open

Different exit code for SIGKILL'ed processes with Spring #676

noizwaves opened this issue May 20, 2022 · 0 comments

Comments

@noizwaves
Copy link

With Spring enabled, a Ruby command interrupted by a signal exits with a different exit code compared to that same command run with Spring disabled.

This issue was detected in our containerized development environments, which run inside of Docker. Because Docker enforces memory constraints by OOM'ing and SIGKILL'ing offending processes. The differing behavior can be observed in an application (Ruby 2.7.5, Rails 7.0.2.4, Spring 4.0.0) when forcing an OOM error:

Spring enabled:

$ bin/rails runner "arr = []; while true do; arr.push(1); end"
Running via Spring preloader in process 242
$ echo $?
0

Spring disabled:

$ DISABLE_SPRING=1 bin/rails runner "arr = []; while true do; arr.push(1); end"
Killed
$ echo $?
137

It looks like the status.exitstatus returned by Process.wait2 is nil for signaled processes, and the conversion to the corresponding unix/POSIX exit code for that signal is not done implicitly. exitstatus is returned directly by terminated processes here.

Could this conversion of signal to exit code be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant