Don't wait for the worker thread to join

If a node is deleted, it can call the AbstractWorkerThread.stop
method while holding the monitor lock on the Jenkins object.  This
will interrupt the GearmanWorkerImpl thread, and then wait for it
to join.  However, if at that moment, the GWI is trying to set
the node offline (due to OFFLINE_NODE_WHEN_COMPLETE being set),
then the system will deadlock while that thread tries to grab
the Jenkins object monitor in order to save the new node
configuration.

Instead, just don't wait for the thread to join, which will
eventually release the monitor lock and allow the GWI thread
to complete.

Change-Id: Ic8dbdf73551feb684ac4f3e46d2ee3e5aef976db
This commit is contained in:
James E. Blair 2013-08-16 12:55:37 -07:00
parent 9f388435d2
commit 8e62012466
1 changed files with 0 additions and 8 deletions

View File

@ -146,14 +146,6 @@ public abstract class AbstractWorkerThread implements Runnable {
// Interrupt the thread so it unblocks any blocking call
thread.interrupt();
logger.info("---- " + getName() + " Joining thread");
// Wait until the thread exits
try {
thread.join();
} catch (InterruptedException e) {
// Unexpected interruption
logger.error("Exception while waiting for thread to join", e);
}
logger.info("---- " + getName() + " Stop request done");
}