Skip to content

Commit

Permalink
Prevent server crash by restarting child
Browse files Browse the repository at this point in the history
Before this change, if Errno::EINVAL is thrown when sending IO to the
child the server would crash. Now we catch the exception and, assuming
the child has problems, we start a new child.
  • Loading branch information
prognostikos committed Sep 12, 2024
1 parent eefc42d commit dca14de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Next Release

* Fixed a bug that would crash the server if sending IO to the child failed

## 4.2.1

* Added `Spring.connect_timeout` and `Spring.boot_timeout` to allow to increase timeout for larger apps.
Expand Down
2 changes: 1 addition & 1 deletion lib/spring/application_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def with_child
if alive?
begin
yield
rescue Errno::ECONNRESET, Errno::EPIPE
rescue Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL
# The child has died but has not been collected by the wait thread yet,
# so start a new child and try again.
log "child dead; starting"
Expand Down

0 comments on commit dca14de

Please sign in to comment.