Skip to content

Commit dca14de

Browse files
committed
Prevent server crash by restarting child
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.
1 parent eefc42d commit dca14de

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Next Release
22

3+
* Fixed a bug that would crash the server if sending IO to the child failed
4+
35
## 4.2.1
46

57
* Added `Spring.connect_timeout` and `Spring.boot_timeout` to allow to increase timeout for larger apps.

lib/spring/application_manager.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def with_child
4242
if alive?
4343
begin
4444
yield
45-
rescue Errno::ECONNRESET, Errno::EPIPE
45+
rescue Errno::ECONNRESET, Errno::EPIPE, Errno::EINVAL
4646
# The child has died but has not been collected by the wait thread yet,
4747
# so start a new child and try again.
4848
log "child dead; starting"

0 commit comments

Comments
 (0)