Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] [Queue] queue:listen default value maxTries=0 let every job fail with a MaxAttemptsExceededException #15370

Closed
larsbo opened this issue Sep 9, 2016 · 7 comments

Comments

@larsbo
Copy link

larsbo commented Sep 9, 2016

  • Laravel Version: 5.3.7
  • PHP Version: 7.0.4
  • Database Driver & Version: MySQL 5.5.39

Description:

When I run queue:listen it spawns new child processes like this by default:
artisan queue:work --once --queue=default --delay=0 --memory=128 --sleep=3 --tries=0 --env=production

This causes a MaxAttemptsExceededException for every single job and make it fail instantly without a single try. If I set maxTries to something larger than 0 the job are correctly processed.

@GrahamCampbell
Copy link
Member

That looks correct.

@GrahamCampbell
Copy link
Member

Max trys 0 means never process any jobs. 1 means only try once.

@larsbo
Copy link
Author

larsbo commented Sep 9, 2016

Well, the code suggests something else for maxTries = 0:
https://github.com/laravel/framework/blob/5.3/src/Illuminate/Queue/Worker.php#L294
As same as the docs: "If you do not specify a value for the --tries option, jobs will be attempted indefinitely."

@sisve
Copy link
Contributor

sisve commented Sep 12, 2016

The linked line of code, and the docs, infer that maxTries=0 should retry indefinitely. The exception you get indicates that the check for $maxTries === 0 failed... so could this be a typing issue where $maxTries is the string "0"?

@larsbo
Copy link
Author

larsbo commented Sep 12, 2016

I logged the queue worker execution and got the following (stripped) result for the WorkerOptions parameters given as console arguments:

[object] (Illuminate\Queue\WorkerOptions: {
"delay":"0",
"memory":"128",
"timeout":60,
"sleep":"3",
"maxTries":"0"
},

This confirms that every argument except the timeoutare interpreted as string instead of int.

Can you please review this issue again, @GrahamCampbell ?

@taylorotwell
Copy link
Member

This was fixed in 5.3.9.

@larsbo
Copy link
Author

larsbo commented Sep 12, 2016

Ah, great! Thank you for the info 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants