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/10/16 09:32:51 UTC

[tomcat] branch 7.0.x updated: Temporary fix. Deadlock in the recently added async state tests

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 b6bba7b  Temporary fix. Deadlock in the recently added async state tests
b6bba7b is described below

commit b6bba7b9b364dad5f740042f0a6252a14eb0016a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Oct 16 10:05:42 2019 +0100

    Temporary fix. Deadlock in the recently added async state tests
    
    Removing this sync fixes the deadlock but re-introduces bug 49884. On
    the basis that a 10s delay is better than a deadlock I am applying
    this temporary fix (mainly to allow the CI to complete) while I
    investigate a solution that creates neither delay nor deadlock.
---
 java/org/apache/tomcat/util/net/AprEndpoint.java | 56 ++++++++++++------------
 1 file changed, 27 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 4d8fd25..10f1eb9 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -975,35 +975,33 @@ public class AprEndpoint extends AbstractEndpoint<Long> {
     public void processSocketAsync(SocketWrapper<Long> socket,
             SocketStatus status) {
         try {
-            synchronized (socket) {
-                if (waitingRequests.remove(socket)) {
-                    SocketProcessor proc = new SocketProcessor(socket, status);
-                    ClassLoader loader = Thread.currentThread().getContextClassLoader();
-                    try {
-                        //threads should not be created by the webapp classloader
-                        if (Constants.IS_SECURITY_ENABLED) {
-                            PrivilegedAction<Void> pa = new PrivilegedSetTccl(
-                                    getClass().getClassLoader());
-                            AccessController.doPrivileged(pa);
-                        } else {
-                            Thread.currentThread().setContextClassLoader(
-                                    getClass().getClassLoader());
-                        }
-                        Executor executor = getExecutor();
-                        if (executor == null) {
-                            log.warn(sm.getString("endpoint.warn.noExector",
-                                    socket, status));
-                            return;
-                        } else {
-                            executor.execute(proc);
-                        }
-                    } finally {
-                        if (Constants.IS_SECURITY_ENABLED) {
-                            PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
-                            AccessController.doPrivileged(pa);
-                        } else {
-                            Thread.currentThread().setContextClassLoader(loader);
-                        }
+            if (waitingRequests.remove(socket)) {
+                SocketProcessor proc = new SocketProcessor(socket, status);
+                ClassLoader loader = Thread.currentThread().getContextClassLoader();
+                try {
+                    //threads should not be created by the webapp classloader
+                    if (Constants.IS_SECURITY_ENABLED) {
+                        PrivilegedAction<Void> pa = new PrivilegedSetTccl(
+                                getClass().getClassLoader());
+                        AccessController.doPrivileged(pa);
+                    } else {
+                        Thread.currentThread().setContextClassLoader(
+                                getClass().getClassLoader());
+                    }
+                    Executor executor = getExecutor();
+                    if (executor == null) {
+                        log.warn(sm.getString("endpoint.warn.noExector",
+                                socket, status));
+                        return;
+                    } else {
+                        executor.execute(proc);
+                    }
+                } finally {
+                    if (Constants.IS_SECURITY_ENABLED) {
+                        PrivilegedAction<Void> pa = new PrivilegedSetTccl(loader);
+                        AccessController.doPrivileged(pa);
+                    } else {
+                        Thread.currentThread().setContextClassLoader(loader);
                     }
                 }
             }


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