You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/09/19 18:58:35 UTC

[tomcat] branch 8.5.x updated: Fix test failures caused by APR crash during shutdown

This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 07f3c37  Fix test failures caused by APR crash during shutdown
07f3c37 is described below

commit 07f3c37377459615a53293ca52be43de7a44970d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 19 19:56:23 2019 +0100

    Fix test failures caused by APR crash during shutdown
    
    When a request thread was still trying to read/write from/to the socket,
    the socket wrapper was not marked as closed so the thread tried to use
    an APR socket that the POller then closed. Trying to read/write from a
    closed APR socket will nearly always trigger a crash.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 4c1ca49..3d1d891 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -1248,8 +1248,11 @@ public class AprEndpoint extends AbstractEndpoint<Long> implements SNICallBack {
             // Close all sockets in the add queue
             info = addList.get();
             while (info != null) {
-                // Make sure the  socket isn't in the poller before we close it
+                // Make sure the socket isn't in the poller before we close it
                 removeFromPoller(info.socket);
+                // Close the SocketWrapper to prevent any still running application
+                // threads from trying to use the socket
+                connections.get(Long.valueOf(info.socket)).close();
                 // Poller isn't running at this point so use destroySocket()
                 // directly
                 destroySocket(info.socket);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org