Skip to content

Ensure that Selectors from SelectorPool don't have old keys in them#3951

Closed
mohamedhafez wants to merge 1 commit intojruby:jruby-9.1.2.0from
mohamedhafez:cleankeys_pr
Closed

Ensure that Selectors from SelectorPool don't have old keys in them#3951
mohamedhafez wants to merge 1 commit intojruby:jruby-9.1.2.0from
mohamedhafez:cleankeys_pr

Conversation

@mohamedhafez
Copy link
Contributor

This PR fixes jruby/jruby-openssl#93

To summarize: I found that many times when you get a Selector from SelectorPool, 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 in selectedKeys() 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

@kares
Copy link
Member

kares commented Jun 4, 2016

interesting patch ... wonder what @headius thinks about this one (in relation to jruby/jruby-openssl#93)

FYI: you should target master the 9.1.2.0 was for the 9.1.2.0 release only, although its fine since its one commit thus easy to cherry-pick on master after a review.

@mohamedhafez
Copy link
Contributor Author

Agh sorry got confused because there were a bunch of extra commits it was trying to include when I tried pulling to master, I've gone ahead and re-made the pull request correctly this time targeting master in #3952

@kares kares added this to the Invalid or Duplicate milestone Jun 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants