GitHub user hachikuji opened a pull request: https://github.com/apache/kafka/pull/4276
KAFKA-6260: Ensure selection keys are removed from all collections on socket close When a socket is closed, we must remove corresponding selection keys from internal collections. This fixes an NPE which is caused by attempting to access the selection key's attached channel after it had been cleared after disconnecting. ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/hachikuji/kafka KAFKA-6260 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/4276.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #4276 ---- commit e715e673b7bca14e2a26a998348528d27ac8a9c8 Author: Jason Gustafson <ja...@confluent.io> Date: 2017-11-29T19:10:39Z KAFKA-6260: Ensure selection keys are removed from all collections on socket close ---- ---