Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1.1
-
None
-
None
-
Linux on PPC - underpowered platform PPC8270
Description
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