This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 6c71eb3 BZ 64660. Avoid NPE in APREndpoint. 6c71eb3 is described below commit 6c71eb3c95faf9e6be93bed835ef5260057abf68 Author: Mark Thomas <ma...@apache.org> AuthorDate: Sun Aug 16 16:26:18 2020 +0100 BZ 64660. Avoid NPE in APREndpoint. --- java/org/apache/tomcat/util/net/AprEndpoint.java | 5 +++++ webapps/docs/changelog.xml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java index 004f7a7..b1aa119 100644 --- a/java/org/apache/tomcat/util/net/AprEndpoint.java +++ b/java/org/apache/tomcat/util/net/AprEndpoint.java @@ -711,6 +711,11 @@ public class AprEndpoint extends AbstractEndpoint<Long,Long> implements SNICallB */ protected boolean processSocket(long socket, SocketEvent event) { SocketWrapperBase<Long> socketWrapper = connections.get(Long.valueOf(socket)); + if (socketWrapper == null) { + // Socket probably closed from another thread. Triggering another + // close in case won't cause an issue. + return false; + } if (event == SocketEvent.OPEN_READ && socketWrapper.readOperation != null) { return socketWrapper.readOperation.process(); } else if (event == SocketEvent.OPEN_WRITE && socketWrapper.writeOperation != null) { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 4635143..1277897 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -100,6 +100,11 @@ stops when a connector is started immediately after it is stopped. (markt) </fix> + <fix> + <bug>64660</bug>: Avoid a potential NPE in the AprEndpoint if a socket + is closed in one thread at the same time as the poller is processing an + event for that socket in another. (markt) + </fix> </changelog> </subsection> <subsection name="WebSocket"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org