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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
     new a370955  Fix BZ 65763 - improve handling of timeout during message 
write
a370955 is described below

commit a3709550e04738cc80515d9508d2fa956e4609e9
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 6 14:12:49 2022 +0000

    Fix BZ 65763 - improve handling of timeout during message write
    
    https://bz.apache.org/bugzilla/show_bug.cgi?id=65763
---
 java/org/apache/tomcat/websocket/WsSession.java | 3 +--
 webapps/docs/changelog.xml                      | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/WsSession.java 
b/java/org/apache/tomcat/websocket/WsSession.java
index ae39d8c..a2e8768 100644
--- a/java/org/apache/tomcat/websocket/WsSession.java
+++ b/java/org/apache/tomcat/websocket/WsSession.java
@@ -19,7 +19,6 @@ package org.apache.tomcat.websocket;
 import java.io.IOException;
 import java.net.URI;
 import java.nio.ByteBuffer;
-import java.nio.channels.WritePendingException;
 import java.nio.charset.StandardCharsets;
 import java.security.Principal;
 import java.util.Collections;
@@ -815,7 +814,7 @@ public class WsSession implements Session {
         msg.flip();
         try {
             wsRemoteEndpoint.sendMessageBlock(Constants.OPCODE_CLOSE, msg, 
true);
-        } catch (IOException | WritePendingException e) {
+        } catch (IOException | IllegalStateException e) {
             // Failed to send close message. Close the socket and let the 
caller
             // deal with the Exception
             if (log.isDebugEnabled()) {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 52005e4..38e10aa 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -166,6 +166,10 @@
         that allows applications to opt to upgrade an HTTP connection to
         WebSocket. (markt)
       </add>
+      <fix>
+        <bug>65763</bug>: Improve handling of WebSocket connection close if a
+        message write times out before the message is fully written. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">

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

Reply via email to