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 10b9f86878 Fix likely cause of some intermittent test failures
10b9f86878 is described below
commit 10b9f86878c14c4360d3ae2c647bcd74f5f1a4dc
Author: Mark Thomas <[email protected]>
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 18d7704f39..d8dfb15e9c 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -660,9 +660,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.
@@ -700,9 +701,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 f0a1bd06e0..8ad32892d2 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: [email protected]
For additional commands, e-mail: [email protected]