Setting job retries to unlimited(--job-retries=0) stops after 256 attempts

Bug #1094089 reported by zlisinski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Gearman
Fix Committed
Low
Brian Aker

Bug Description

In the function gearman_server_job_queue() in file libgearman-server/job.c, the code is never checking to see if the number of job retries requested is equal to zero. It only checks if the number of requested retries is equal to the current number of retries. Since the current retry count variable is only a uint8, it overflows after 256 attempts, and triggers the conditional.

I fount this issue in versions 0.33, and it looks like it is present in all versions up to the latest. I have attached a patch to fix this issue.

Also, what was the point of limiting the retry count to a uint8? Setting job-retries to something larger than 255 also triggers the same problem, although that seems to be because the code is casting a uint32 that it reads from the command line options into a uint8 inside main() in gearmand/gearmand.cc.

Revision history for this message
zlisinski (zlisinski) wrote :
Brian Aker (brianaker)
Changed in gearmand:
assignee: nobody → Brian Aker (brianaker)
importance: Undecided → Low
status: New → In Progress
milestone: none → 1.0.3
Brian Aker (brianaker)
Changed in gearmand:
status: In Progress → Fix Committed
Revision history for this message
zlisinski (zlisinski) wrote :

Thanks for the quick fix, however you missed one change. The value is still being cast to a uint8 when being passed to the gearmand_create() function on line 350 in gearmand/gearmand.cc.

Revision history for this message
vivek (goelvivek2011) wrote :

Hi,
I am facing the same problem.
Any timeline about this fix ?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.