Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-24050] don't let canceled keys kill the selector thread
In looking at the proposed PR #24 (#24), I feel bit uneasy to mask the problem like it does. The code in question is looping through selected keys and processing it one by one. The only code that calls key.cancel() is done from the selector thread that runs this loop. So I don't understand how it is possible that the key picked up from selected key set is already cancelled here. I wonder if something more is going on. Regardless, I agree that this shouldn't kill the selector thread, which breaks all the slaves in one go. This change flags and reports the problem, kill the connection related to that key, then continue to serve other connections.
- Loading branch information
1083a97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wonder if anything should be allowed to kill the selector thread (with the possible exception of an InterrputedException), anyways just my 2c (although maybe it's worth less :D)
Also I guess I'm wondering the same things as: http://stackoverflow.com/questions/12912388/getting-java-nio-channels-cancelledkeyexception-without-explicit-cancellation-of
We do rip a ton of Slaves from Jenkins, usually not particularly abruptly (we remove them on the Jenkins side first then delete them).
Thanks a bunch for the fix, I'll pick it up as soon as it's released and toss the logs in JIRA when we get them.
1083a97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kbrowder, thanks for finding that stackoverflow thread. The ansewr from EJP is something I can test, and it'd shed light on the behaviour of this. I'll try that.
1083a97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there's a new remoting jar (2.45) released with this change, will this make it into the next Jenkins (1.580)? Just wondering if I'm going to be updating our Jenkins install in the next week. Just noticed that the Jenkins pom is still on 2.44 on rc and master.
1083a97
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've submitted pull request jenkinsci/jenkins#1393 that will pull in 2.45 as part of some other changes that I made to remoting. Hopefully that should get merged soon.