This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 878bf50299 Fix likely cause of some intermittent test failures 878bf50299 is described below commit 878bf502998d45595bc2438dbedf7b92a6c1eb4f 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 3e524e3fa0..8eaf0fabf8 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