From 08e9c429de050d0e6ac777579aa901552d27f7ba Mon Sep 17 00:00:00 2001 From: Khai Do Date: Tue, 16 Jun 2015 12:37:06 -0700 Subject: [PATCH] Fix deadlock from a WORK_FAIL event A lock is kept on a gearman worker when a WORK_FAIL event happens. This causes the worker therad to stall on the next attempt that the AvailabilityMonitor attempt to get a lock on the worker. This causes the jenkins nodes to stop working (not run builds anymore). Unlock the worker on a WORK_FAIL event to avoid this deadlock state. This fixes issue https://issues.jenkins-ci.org/browse/JENKINS-28891 Change-Id: I015ce9732fd535676a832680f39e220b09df95cf --- src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java b/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java index 72118ea..ca1c30c 100644 --- a/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java +++ b/src/main/java/hudson/plugins/gearman/MyGearmanWorkerImpl.java @@ -572,6 +572,7 @@ public class MyGearmanWorkerImpl implements GearmanSessionEventHandler { new GearmanPacketImpl(GearmanPacketMagic.REQ, GearmanPacketType.WORK_FAIL, handle)); session.submitTask(gsr); + availability.unlock(this); enqueueNoopEvent(); } else { GearmanFunction function = def.getFactory().getFunction();