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

commit 036c09537dffc447d7392797f4cd097b7473f938
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 21379e0..88ab292 100644
--- a/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
+++ b/test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java
@@ -403,7 +403,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;
         }
 
@@ -425,9 +425,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