[tomcat] branch 8.5.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 8.5.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 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 6834b1a  Fix one potential cause of JVM crash on shutdown with APR/native
6834b1a is described below

commit 6834b1a0469711b4662bd0702dcf2ff8a491393a
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 b51d156..b0a14bf 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -528,6 +528,12 @@ public class AprEndpoint extends AbstractEndpoint<Long> implements SNICallBack {
                    }
                 }
             }
+            // 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 8f8e6a5..72af857 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -156,6 +156,10 @@
         of abusive client behaviour and close the connection if any such
         behaviour is detected. (markt)
       </add>
+      <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="Web applications">


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