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

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


The following commit(s) were added to refs/heads/10.1.x by this push:
     new b0aff8885f Fix likely cause of some intermittent test failures
b0aff8885f is described below

commit b0aff8885f8c301afe8ebb7c7d60de304bf9df41
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Apr 26 08:38:08 2023 +0100

    Fix likely cause of some intermittent test failures
---
 java/org/apache/tomcat/websocket/WsSession.java | 14 ++++++++------
 webapps/docs/changelog.xml                      |  4 ++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index b8fe3b1db4..fc498b200f 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -577,9 +577,10 @@ public class WsSession implements Session {
         // Flush any batched messages not yet sent.
         try {
             wsRemoteEndpoint.setBatchingAllowed(false);
-        } catch (IOException e) {
-            log.warn(sm.getString("wsSession.flushFailOnClose"), e);
-            fireEndpointOnError(e);
+        } catch (Throwable t) {
+            ExceptionUtils.handleThrowable(t);
+            log.warn(sm.getString("wsSession.flushFailOnClose"), t);
+            fireEndpointOnError(t);
         }
 
         // Send the close message to the remote endpoint.
@@ -617,9 +618,10 @@ public class WsSession implements Session {
             // Flush any batched messages not yet sent.
             try {
                 wsRemoteEndpoint.setBatchingAllowed(false);
-            } catch (IOException e) {
-                log.warn(sm.getString("wsSession.flushFailOnClose"), e);
-                fireEndpointOnError(e);
+            } catch (Throwable t) {
+                ExceptionUtils.handleThrowable(t);
+                log.warn(sm.getString("wsSession.flushFailOnClose"), t);
+                fireEndpointOnError(t);
             }
 
             // Send the close message response to the remote endpoint.
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0625f7ea6b..d9badc751b 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -132,6 +132,10 @@
         <bug>66575</bug>: Avoid unchecked use of the backing array of a
         buffer provided by the user in the compression transformation. (remm)
       </fix>
+      <fix>
+        Improve exception handling when flushing batched messages during
+        WebSocket session close. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>


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

Reply via email to