[tomcat] branch 7.0.x updated: Fix one potential cause of JVM crash on shutdown with APR/native

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch 7.0.x updated: Fix one potential cause of JVM crash on shutdown with APR/native

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

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


The following commit(s) were added to refs/heads/7.0.x by this push:
     new 0e5cd57  Fix one potential cause of JVM crash on shutdown with APR/native
0e5cd57 is described below

commit 0e5cd5724e6b25f497302c694e4ba5d5bd9245df
Author: Mark Thomas <[hidden email]>
AuthorDate: Wed Aug 14 00:05:04 2019 +0100

    Fix one potential cause of JVM crash on shutdown with APR/native
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 6 ++++++
 webapps/docs/changelog.xml                       | 4 ++++
 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 adb01b6..ba54c1d 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -779,6 +779,12 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
                    }
                 }
             }
+            // Close any sockets not in the poller performing blocking
+            // read/writes. Need to do this before destroying the poller since
+            // that will also destroy the root pool for these sockets.
+            for (Long s : connections.keySet()) {
+                Socket.shutdown(s.longValue(), Socket.APR_SHUTDOWN_READWRITE);
+            }
             try {
                 poller.destroy();
             } catch (Exception e) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ec865ef..7c98806 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -89,6 +89,10 @@
         <bug>63636</bug>: <code>Context.findRoleMapping()</code> never called
         in <code>StandardWrapper.findSecurityReference()</code>. (michaelo)
       </fix>
+      <fix>
+        Fix a crash on shutdown with the APR/native connector when a blocking
+        I/O operation was still in progress when the connector stopped. (markt)
+      </fix>
      </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]