WebServer worker thread is stuck with on an incoming XML RPC call
-----------------------------------------------------------------

                 Key: XMLRPC-162
                 URL: https://issues.apache.org/jira/browse/XMLRPC-162
             Project: XML-RPC
          Issue Type: Bug
    Affects Versions: 3.1.1
         Environment: Linux on PPC - very slow CPU
            Reporter: Mark Gertsvolf


I am running XML-RPC server on an underpowered Linux PPC box with JamVM or 
Cacao, both use GNU classlib. This environment exposes a race condition in the 
WebServer code.
Specificlly the issue is with how org.apache.xmlrpc.util.ThreadPool signals the 
worker threads.

Poolable.startTask creates a new Poolable object  and calls Poolable.start, 
which sets the Poolable.task member and signals the thread encapsulated by 
Poolable object. However, there is a potential race condition where the signal 
can be lost if the encapsulated thread has just pased beyond the getTask check:
(line 55 trunk/common/src/main/java/org/apache/xmlrpc/util/ThreadPool.java - 
revision 720508)
The worker thread is suspended on wait and there is nobody to wake him up.

One way of fixing this issue is to add (getTask() == null) check inside the 
synchronized block.

diff:

Index: 
/var/opt/apachews/trunk/common/src/main/java/org/apache/xmlrpc/util/ThreadPool.java
===================================================================
--- 
/var/opt/apachews/trunk/common/src/main/java/org/apache/xmlrpc/util/ThreadPool.java
 (revision 720508)
+++ 
/var/opt/apachews/trunk/common/src/main/java/org/apache/xmlrpc/util/ThreadPool.java
 (working copy)
@@ -56,7 +56,9 @@
                         if (t == null) {
                             try {
                                 synchronized (this) {
-                                    wait();
+                                    if (!isShuttingDown() && getTask() == 
null) {
+                                       wait();
+                                    }
                                 }
                             } catch (InterruptedException e) {
                                 // Do nothing



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to