You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/12/04 13:00:11 UTC

[tomcat] branch 7.0.x updated: Fix a very unlikely concurrency issue writing WebSocket msgs

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

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


The following commit(s) were added to refs/heads/7.0.x by this push:
     new aba28fc  Fix a very unlikely concurrency issue writing WebSocket msgs
aba28fc is described below

commit aba28fc653e7eac7ba365bbe38d8373658d2f39f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Dec 4 12:55:18 2019 +0000

    Fix a very unlikely concurrency issue writing WebSocket msgs
---
 java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java | 5 ++---
 webapps/docs/changelog.xml                                     | 8 ++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
index ef4505d..be719a0 100644
--- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
+++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
@@ -50,8 +50,7 @@ import org.apache.tomcat.util.res.StringManager;
 
 public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint {
 
-    private static final StringManager sm =
-            StringManager.getManager(Constants.PACKAGE_NAME);
+    private static final StringManager sm = StringManager.getManager(WsRemoteEndpointImplBase.class);
 
     // Milliseconds so this is 20 seconds
     private static final long DEFAULT_BLOCKING_SEND_TIMEOUT = 20 * 1000;
@@ -825,7 +824,7 @@ public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint {
         private final ByteBuffer outputBuffer;
         private final boolean flushRequired;
         private final WsRemoteEndpointImplBase endpoint;
-        private int maskIndex = 0;
+        private volatile int maskIndex = 0;
 
         public OutputBufferSendHandler(SendHandler completion,
                 ByteBuffer headerBuffer, ByteBuffer payload, byte[] mask,
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 3ee3850..66737e3 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -97,6 +97,14 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="WebSocket">
+    <changelog>
+      <fix>
+        Ensure a very unlikely concurrency issue is avoided when writing
+        WebSocket messages. (markt)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Web applications">
     <changelog>
       <add>


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