Skip to content

Keep the Puma plugin's shutdown going when its output is gone - #800

Open
rosa wants to merge 2 commits into
mainfrom
ignore-closed-terminal-in-puma-plugin
Open

Keep the Puma plugin's shutdown going when its output is gone#800
rosa wants to merge 2 commits into
mainfrom
ignore-closed-terminal-in-puma-plugin

Conversation

@rosa

@rosa rosa commented Aug 30, 2026

Copy link
Copy Markdown
Member

Fixes #737.

When the terminal that started Puma goes away, the plugin's monitor thread notices the parent change, then log raises Errno::EIO writing to the dead PTY before Process.kill(:INT, $$) runs, so the supervisor and its children outlive the terminal and keep the port. Rescuing the error in log lets 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::EPIPE and Errno::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

afurm and others added 2 commits August 30, 2026 19:11
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
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

Successfully merging this pull request may close these issues.

Puma plugin: Solid Queue processes persist after terminal close due to Errno::EIO blocking shutdown

2 participants