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
This commit is contained in:
Khai Do 2015-06-16 12:37:06 -07:00 committed by Antoine Musso
parent f2024bd53e
commit 08e9c429de
1 changed files with 1 additions and 0 deletions

View File

@ -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();