Author: markt Date: Wed Jan 5 13:51:48 2011 New Revision: 1055458 URL: http://svn.apache.org/viewvc?rev=1055458&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50467 Protect against NPE that will cause Poller to fail
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1055458&r1=1055457&r2=1055458&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Wed Jan 5 13:51:48 2011 @@ -1141,9 +1141,15 @@ public class NioEndpoint extends Abstrac 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 Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1055458&r1=1055457&r2=1055458&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Wed Jan 5 13:51:48 2011 @@ -195,6 +195,11 @@ Remove a huge memory leak in the NIO connector introduced by the fix for <bug>49884</bug>. (markt) </fix> + <fix> + <bug>50467</bug>: Protected against NPE triggered by a race condition + that causes the NIO poller to fail, preventing the processing of further + requests. (markt) + </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org