Updated openstack/openstack

Project: openstack-infra/gearman-plugin  0314ab1ea2f959eca0a89214483cb4f16fa92829

Fix race between adding job and registering

Gearman plugin had a race between adding jobs to the functionList and
registering jobs. When registering jobs the functionMap is cleared, when
adding a job the plugin checks if the job is in the function Map before
running it. If we happen to trigger registration of jobs when we get a
response from gearman with a job assignment then the functionMap can be
empty making us send a work fail instead of running the job.

To make things worse this jenkins worker would not send a subsequent
GET JOB and would live lock never doing any useful work.

Correct this by making the processing for gearman events synchronous in
the work loop. This ensures that we never try to clear the function map
and check against it at the same time via different threads. To make
this happen the handleSessionEvent() method puts all events on a thread
safe queue for synchronous processing. This has allowed us to simplify
the work() loop and basically do the following:

  while running:
    init()
    register()
    process one event
    run function if processed
    drive IO

This is much easier to reason about as we essentially only have
bookkeeping and the code for one thing at a time.

Change-Id: Id537710f6c8276a528ad78afd72c5a7c8e8a16ac
This commit is contained in:
Jenkins 2015-05-06 20:08:59 +00:00 committed by Gerrit Code Review
parent c308af2a1c
commit c85eae9c73
1 changed files with 1 additions and 1 deletions

@ -1 +1 @@
Subproject commit 7abfdbd2d00010a1121cefebf479bcf104e7ef18
Subproject commit 0314ab1ea2f959eca0a89214483cb4f16fa92829