Project: Tomcat
Bug 54513 NullPointerException in AprEndpoint$Poller.run
Reported: 2013-01-31 23:15:59 | Status: resolved fixed

Trunk at r1441188, running the test suite with APR connector, Native 1.1.26 Windows 32-bit with JDK 7u11. I encountered the following when running org.apache.catalina.loader.TestVirtualContext test On second re-run of the test the same issue happened, so it is as if there is something specific here. I have not encountered the issue with the rest of testsuite yet. [[[ Feb 01, 2013 2:07:26 AM org.apache.tomcat.util.net.AprEndpoint$Poller run WARNING: Unexpected poller error java.lang.NullPointerException at org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper.access$200(AprEndpoint.java:2198) at org.apache.tomcat.util.net.AprEndpoint$Poller.run(AprEndpoint.java:1632) at java.lang.Thread.run(Thread.java:722) ]]] The code at AprEndpoint$Poller.run(AprEndpoint.java:1632) is 1628 for (int n = 0; n < rv; n++) { 1629 timeouts.remove(desc[n*2+1]); 1630 AprSocketWrapper wrapper = connections.get( 1631 Long.valueOf(desc[n*2+1])); 1632 wrapper.pollerFlags = wrapper.pollerFlags & ~((int) desc[n*2]); I suspect that "wrapper" is null here. The above code is specific to Tomcat trunk and is not present in 7.0.x. When this happened, the test hung for 15 minutes (1000 secs) waiting on a socket read. When time out passed, it continued to run all the other tests. [[[ Testcase: testAdditionalWebInfClassesPaths took 1 006,735 sec Caused an ERROR Read timed out java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:150) at java.net.SocketInputStream.read(SocketInputStream.java:121) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) at java.io.BufferedInputStream.read(BufferedInputStream.java:334) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:633) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) at org.apache.catalina.startup.TomcatBaseTest.methodUrl(TomcatBaseTest.java:247) at org.apache.catalina.startup.TomcatBaseTest.getUrl(TomcatBaseTest.java:219) at org.apache.catalina.startup.TomcatBaseTest.getUrl(TomcatBaseTest.java:213) at org.apache.catalina.startup.TomcatBaseTest.getUrl(TomcatBaseTest.java:202) at org.apache.catalina.loader.TestVirtualContext.assertPageContains(TestVirtualContext.java:326) at org.apache.catalina.loader.TestVirtualContext.assertPageContains(TestVirtualContext.java:320) at org.apache.catalina.loader.TestVirtualContext.testAdditionalWebInfClassesPaths(TestVirtualContext.java:311) ]]]

Files changed in fix:
java/org/apache/tomcat/util/net/AprEndpoint.java