Author: markt
Date: Thu Mar 23 12:24:40 2017
New Revision: 1788224
URL: http://svn.apache.org/viewvc?rev=1788224&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=60900
Avoid a NullPointerException in the APR Poller if a connection is closed at the
same time as new data arrives on that connection.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=1788224&r1=1788223&r2=1788224&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Thu Mar 23
12:24:40 2017
@@ -1617,15 +1617,21 @@ public class AprEndpoint extends Abstrac
pollerSpace[i] += rv;
connectionCount.addAndGet(-rv);
for (int n = 0; n < rv; n++) {
- long timeout = timeouts.remove(desc[n*2+1]);
- AprSocketWrapper wrapper = connections.get(
- Long.valueOf(desc[n*2+1]));
if (getLog().isDebugEnabled()) {
log.debug(sm.getString(
"endpoint.debug.pollerProcess",
Long.valueOf(desc[n*2+1]),
Long.valueOf(desc[n*2])));
}
+ long timeout = timeouts.remove(desc[n*2+1]);
+ AprSocketWrapper wrapper = connections.get(
+ Long.valueOf(desc[n*2+1]));
+ if (wrapper == null) {
+ // Socket was closed in another thread
while still in
+ // the Poller but wasn't removed from the
Poller before
+ // new data arrived.
+ continue;
+ }
wrapper.pollerFlags = wrapper.pollerFlags &
~((int) desc[n*2]);
// Check for failed sockets and hand this
socket off to a worker
if (((desc[n*2] & Poll.APR_POLLHUP) ==
Poll.APR_POLLHUP)
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1788224&r1=1788223&r2=1788224&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu Mar 23 12:24:40 2017
@@ -108,6 +108,11 @@
that is not consistent with the current state of that connection.
(markt)
</fix>
+ <fix>
+ <bug>60900</bug>: Avoid a <code>NullPointerException</code> in the APR
+ Poller if a connection is closed at the same time as new data arrives
on
+ that connection. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="jdbc-pool">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]