rescue Errno::EBADF when closing pipe #92
Merged
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.
It's possible for the pipe to be invalid by the time we attempt to close it, causing it to raise
Errno::EBADF
:I don't fully understand the circumstances which lead to this but it happens to me and others on my team regularly (Ruby 3.0.3, macOS Monterey + Big Sur, running a Rails 6.1 app with puma 5.2.2). Possibly similar to #40
It does not appear to have any negative effects and since we're closing the pipe at this point anyway I don't think we can do much about it - the error output is distracting and doesn't seem actionable. Hence I suggest we rescue
Errno::EBADF
when closing the pipe just like we do forIOError
.