Queued jobs in redis backend are orphaned if Gearman server dies

Asked by Danny Kopping

When using Redis as the persistence backend, queued jobs are set in Redis like so:

1466949136.176673 [0 127.0.0.1:61635] "SET" "_gear_-process-job-fdaa984bed6075f02e9971734e57c20f260a704d\x00\x00\x00" "workload"

redis-cli info | grep db0

-> db0:keys=1,expires=0,avg_ttl=0

(echo 'status'; sleep 0.1) | nc 127.0.0.1 4730

-> process-job 1 0 0

This shows there is 1 job in the queue, and that job is stored in Redis - all fine at this point.

Now, let's say the Gearman server is killed for whatever reason... When Gearman starts up again, it doesn't know about these queued jobs and they are effectively "orphaned".

Is there a workaround for this?

Question information

Language:
English Edit question
Status:
Open
For:
Gearman Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Kiril Angov (kiril.angov) said :
#1

There is a pretty nasty bug in the Redis "persistence" which pretty much makes this plugin a noop. You put stuff in but it can never replay them because there is an error in the KEYS command it uses for replaying from Redis.

https://github.com/gearman/gearmand/commit/40028f8ba1a1d4f610a55a6d0a08683525372483#diff-7580c1cc3895914f180088198d7f8c92R255

This is the fix, you might need to just update to the latest version.

Can you help with this problem?

Provide an answer of your own, or ask Danny Kopping for more information if necessary.

To post a message you must log in.