Ensure that Selectors from SelectorPool don't have old keys in them#3952
Merged
headius merged 1 commit intojruby:masterfrom Jun 28, 2016
mohamedhafez:cleankeys_pr2
Merged
Ensure that Selectors from SelectorPool don't have old keys in them#3952headius merged 1 commit intojruby:masterfrom mohamedhafez:cleankeys_pr2
headius merged 1 commit intojruby:masterfrom
mohamedhafez:cleankeys_pr2
Conversation
Member
|
This looks pretty good, and may also tidy up some occasional reports we've had of unknown or invalid keys getting into other selects. |
Member
|
@mohamedhafez Thank you! |
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.
(Note this is the same as #3951 but targeting master, sorry for the confusion!)
This PR fixes jruby/jruby-openssl#93
To summarize: I found that many times when you get a
SelectorfromSelectorPool, it already had old keys in it, and that was causing problems as reported in the issue. Something somewhere was returning selectors without cleaning up its keys properly, I think possibly this line (perhaps the key needs to be cancelled even if its invalid or it may still show up inselectedKeys()under certain conditions?). Its also possible that some gem out there I don't know about uses the method and doesn't clean the keys properly.Instead of repeating the key-cleaning code in (at least) the 3 places in jruby and jruby-openssl, I figure the best fix is to do the cleaning inside of
SelectorPool#put, so its only done in one place, and done correctly.I've been running this patch in production and its completely fixed this issue, and I don't see any
Selectors with old keys any more, and haven't seen any unwanted side effects