Make sure to iterate over all keys when cancelling keys in a SelectorPool#4471
Make sure to iterate over all keys when cancelling keys in a SelectorPool#4471headius merged 1 commit intojruby:masterfrom
Conversation
|
Hmm, what exceptions are being thrown at https://github.com/jruby/jruby/pull/4471/files#diff-f99fc044de4e2aa68b3bb1f212348b07R92 ? If the cancelling fails for some reason and the If the |
|
The exceptions are getting swallowed somewhere so I haven't seen what they are. I could try adding logging to capture them if you're interested? From what you're saying it sounds like I should remove the |
|
@cheister yeah could you put in logging to see what the exceptions are, and also to check the status of |
91a7b27 to
cfff122
Compare
|
The exception being thrown was an NPE because the key was null. So changing the code to check for null also makes it work. |
cfff122 to
ac1d2da
Compare
|
Great find, thank you! |
When we updated our server from 9.1.2.0 to 9.1.7.0 we started seeing a file descriptor leak which, if left for long enough, would run the machine out of file descriptors.
We tracked down the problem to #3952 which changed how SelectionKeys were closed.
It looks like if exceptions aren't caught while calling
cancelon the SelectionKeys then the loop can exit early and leave some keys un-cancelled.When we went back to the same key cancelling code that was used in 9.1.2.0 the problem went away.