From: markt Date: Wed, 5 Jan 2011 13:51:48 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50467 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0f3b4d55153a474df9e732460bcefcd9f4b3790f;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50467 Protect against NPE that will cause Poller to fail git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1055458 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java b/java/org/apache/tomcat/util/net/NioEndpoint.java index 095afcba6..e37712164 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -1141,9 +1141,15 @@ public class NioEndpoint extends AbstractEndpoint { while (iterator != null && iterator.hasNext()) { SelectionKey sk = iterator.next(); KeyAttachment attachment = (KeyAttachment)sk.attachment(); - attachment.access(); - iterator.remove(); - processKey(sk, attachment); + // Attachment may be null if another thread has called + // cancelledKey() + if (attachment == null) { + iterator.remove(); + } else { + attachment.access(); + iterator.remove(); + processKey(sk, attachment); + } }//while //process timeouts diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 3c331b9c4..f655372f3 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -195,6 +195,11 @@ Remove a huge memory leak in the NIO connector introduced by the fix for 49884. (markt) + + 50467: Protected against NPE triggered by a race condition + that causes the NIO poller to fail, preventing the processing of further + requests. (markt) +