You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/09/05 17:59:19 UTC

DO NOT REPLY [Bug 40418] New: - APR connector deadlock

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418

           Summary: APR connector deadlock
           Product: Tomcat 5
           Version: 5.5.17
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Connector:HTTP
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: vbeltran@ac.upc.edu


Under high ssl load (SPECweb2005 Banking application) the acceptor thread stops
accepting new connections. The acceptor blocks in getWorkerThread() because
there isn't Worker threads available and maxThreads has been reached. The
problem is that all Worker threads are blocked waiting for a socket to process,
but this socket is never assigned because there is a leak in the Acceptor thread
code. I can attach the stacktrace of the relevant threads if necessary.

Regards,
 
- Vicen�


This modification remove the leak of Worker threads.

Index: connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
===================================================================
--- connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java   
(revision 130)
+++ connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java    (working
copy)
@@ -980,6 +980,7 @@
          */
         public void run() {

+            Worker workerThread = null;
             // Loop until we receive a shutdown command
             while (running) {

@@ -994,12 +995,15 @@

                 try {
                     // Allocate a new worker thread
-                    Worker workerThread = getWorkerThread();
+                    if (workerThread == null)
+                        workerThread = getWorkerThread();
+
                     // Accept the next incoming connection from the server socket
                     long socket = Socket.accept(serverSock);
                     // Hand this socket off to an appropriate processor
                     if (setSocketOptions(socket)) {
                         workerThread.assign(socket);
+                        if(socket != 0) workerThread = null;
                     } else {
                         // Close socket and pool right away
                         Socket.destroy(socket);

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40418] - APR connector deadlock

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418





------- Additional Comments From remm@apache.org  2006-09-06 13:40 -------
There's a small glitch remaining with that commit, since I put everything on one
line of code (unlike on the TC 6 branch), which is a mistake if accept throws an
exception (after verification, it cannot return 0) - it is allowed but most
likely it is not going to happen. I fixed that in a new commit.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40418] - APR connector deadlock

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418





------- Additional Comments From remm@apache.org  2006-09-06 11:14 -------
*** Bug 40423 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40418] - APR connector deadlock

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418





------- Additional Comments From remm@apache.org  2006-09-06 11:08 -------
You need to test again with the current Tomcat code.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40418] - APR connector deadlock

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418





------- Additional Comments From vbeltran@ac.upc.edu  2006-09-06 10:40 -------
(In reply to comment #1)
> This is not making sense. If you think accept can return 0 when using SSL, then
> there's a bug with accept (since it's most likely not supposed to return a null
> pointer; I have not coded for that case, and it's a miracle it doesn't just
> crash right away), it has nothing to do with a "deadlock".

(In reply to comment #1)
> This is not making sense. If you think accept can return 0 when using SSL, then
> there's a bug with accept (since it's most likely not supposed to return a null
> pointer; I have not coded for that case, and it's a miracle it doesn't just
> crash right away), it has nothing to do with a "deadlock".

If setSocketOptions() returns false the connector leak one Worker thread or am I
missing something?

- Vicen�

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40418] - APR connector deadlock

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418


vbeltran@ac.upc.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From vbeltran@ac.upc.edu  2006-09-06 13:15 -------
(In reply to comment #3)
> You need to test again with the current Tomcat code.

Now I see the commit http://svn.apache.org/viewvc?rev=429003&view=rev. Sorry for
the noise.

Thanks,

- Vicen�


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 40418] - APR connector deadlock

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40418>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40418





------- Additional Comments From remm@apache.org  2006-09-06 09:40 -------
This is not making sense. If you think accept can return 0 when using SSL, then
there's a bug with accept (since it's most likely not supposed to return a null
pointer; I have not coded for that case, and it's a miracle it doesn't just
crash right away), it has nothing to do with a "deadlock".

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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