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 35d87d4  Fix intermittently failing test.
35d87d4 is described below

commit 35d87d49a6b33dde2df5a79eaa24c92ec508b4b6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Sep 10 21:29:50 2020 +0100

    Fix intermittently failing test.
    
    If you fake a blocking with async write while processing a read there is
    a strong chance of a deadlock. The read will be holding a lock on the
    SocketWrapper. If the async write does not complete in-line it will
    perform a dispatch when it is ready to write and that dispatch will try
    to obtain a lock on the socket wrapper. The lock on that opbject is
    already held and a deadlock will follow.
---
 test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java 
b/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
index f929d67..7c5d35d 100644
--- a/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
+++ b/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
@@ -404,7 +404,7 @@ public class TestEncodingDecoding extends TomcatBaseTest {
         @OnMessage
         public String onMessage(String message, Session session) throws 
Exception {
             received.add(message);
-            session.getAsyncRemote().sendText(MESSAGE_ONE).get();
+            session.getBasicRemote().sendText(MESSAGE_ONE);
             return message;
         }
 
@@ -426,9 +426,9 @@ public class TestEncodingDecoding extends TomcatBaseTest {
         @OnMessage
         public String onMessage(String message, Session session) throws 
IOException {
             received.add(message);
-            session.getAsyncRemote().setBatchingAllowed(true);
-            session.getAsyncRemote().sendText(MESSAGE_ONE);
-            session.getAsyncRemote().setBatchingAllowed(false);
+            session.getBasicRemote().setBatchingAllowed(true);
+            session.getBasicRemote().sendText(MESSAGE_ONE);
+            session.getBasicRemote().setBatchingAllowed(false);
             return MESSAGE_TWO;
         }
 


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

Reply via email to