Skip to content

Conversation

@MSP-Greg
Copy link
Member

Description

The issue - how to make Puma respond gracefully when a io connection can misbehave/fail at any point in its handling?

This is a difficult thing to test in CI, especially with multiple VM's running on CI runners.

The are infrequent errors in Puma CI, one example below:

Error in reactor loop escaped: mode not supported for this object: r (ArgumentError)
org/nio4r/Selector.java:124:in `register'
/Users/runner/work/puma/puma/lib/puma/reactor.rb:93:in `register'
/Users/runner/work/puma/puma/lib/puma/reactor.rb:77:in `select_loop'
/Users/runner/work/puma/puma/lib/puma/reactor.rb:34:in `block in run'

The error mode not supported for this object: r implies that the socket is no longer valid in some way.

Does it represent a CI specific issue, or is it something that could occur in real use?

At present, there is a great deal of 'rescue handling' re sockets, and where and how exceptions are raised/caught can get messy.

So, is there a way to conditionally test the socket? This PR is just a guess, using an io_ok? method in Client.

I believe @schneems has mentioned something similar somewhere.

Anyway, if people think it's valid, maybe a method needs to also be added somewhere that takes a socket as a parameter, which Client#io_ok? could call. I also haven't thought about logging, etc.

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added an entry to History.md if this PR fixes a bug or adds a feature. If it doesn't need an entry to HISTORY.md, I have added [changelog skip] or [ci skip] to the pull request title.
  • I have added appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop.

@nateberkopec nateberkopec added bug waiting-for-changes Waiting on changes from the requestor labels Oct 20, 2020
@nateberkopec
Copy link
Member

Seems valid to me.

@MSP-Greg MSP-Greg changed the title Add Client#io_ok?, check before Reactor#register [changelog skip] Add Client#io_ok?, check before Reactor#register Oct 23, 2020
@MSP-Greg MSP-Greg marked this pull request as ready for review October 23, 2020 14:58
@MSP-Greg MSP-Greg removed the waiting-for-changes Waiting on changes from the requestor label Oct 23, 2020
@nateberkopec nateberkopec merged commit 6c69e29 into puma:master Oct 25, 2020
@MSP-Greg MSP-Greg deleted the client-ok branch October 28, 2020 14:12
MSP-Greg added a commit to MSP-Greg/puma that referenced this pull request Nov 2, 2020
…ect: r'

puma#2432/6c69e29ac31 was an attempt to catch a reactor loop error:

Error in reactor loop escaped: mode not supported for this object: r (ArgumentError)

Error still intermittently happens,  Revert previous, add rescue in `Reactor#register
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants