Keep the Puma plugin's shutdown going when its output is gone - #800
Open
rosa wants to merge 2 commits into
Open
Conversation
A closed terminal raises Errno::EIO, but the same monitor thread can also find its output gone as EPIPE (stdout piped to a reader that exited) or EBADF (stream already closed during shutdown). Treat the three the same way, and cover each in the test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CACej2M9mLVDwpE3Bk8V41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #737.
When the terminal that started Puma goes away, the plugin's monitor thread notices the parent change, then
lograisesErrno::EIOwriting to the dead PTY beforeProcess.kill(:INT, $$)runs, so the supervisor and its children outlive the terminal and keep the port. Rescuing the error inloglets the shutdown proceed.The first commit is @afurm's fix from #741, cherry-picked as they wrote it (closed unmerged; thank you!), including the unit test that the monitor still sends INT when logging raises. The second broadens the rescue to
Errno::EPIPEandErrno::EBADF, which are the same failure with stdout piped to a reader that exited or with the stream already closed, and covers all three in the test.Verified: the new unit test and the Puma plugin integration tests pass on sqlite; rubocop clean.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CACej2M9mLVDwpE3Bk8V41