#Potential causes of ~50% of dispatched Jobs not getting executed?

8 messages · Page 1 of 1 (latest)

white mauve
#

Can anyone comment or give suggestions for why only 50% of the Dispatched jobs being executed? I am running a Laravel Nova action where I have created a loop for testing by setting it to dispatch approximately 15 jobs - the job class which you can see in the code below:

https://gist.github.com/HeadStudios/cc5cf9518b2fc6fa96aef22c3013c7a6

My queue:listen command only shows 5 jobs executed and completed (as per attachment)

And also note that there are no jobs with errors nor any errors being shown in laravel.log

However checking the dumps as per below:
https://gist.github.com/HeadStudios/e89b52131d4e256e3868cccf274dbd3f (disregard final dump as it relates to a kernel task being executed outside of dev1)

You'll notice on dumps searching for the keyword 'Dispatching the following contact:' returns 16 results (as per attachment) - showing me that the jobs were dispatched - however there is no trace of them - and they fundamentally are "Ghost" jobs - I am confused as to why this is and any input on my issue and the cause of my "Ghost" jobs would be much appreciated.

Thank you!

Gist

GitHub Gist: instantly share code, notes, and snippets.

Gist

GitHub Gist: instantly share code, notes, and snippets.

fierce tinsel
#

You've opened 3 threads back-to-back within an hour or something essentially regarding the same issue.

Please take some time debugging yourself and cleaning up in your code / fix your environment, you're clearly not getting very far developing like this and leaning against us...

white mauve
fierce tinsel
#

r/woosh

white mauve
# fierce tinsel r/woosh

Ok, I can confirm 10 jobs are executed when it's an isolated job - so I do take your point on board. I guess I'll have to look through xDebug and this is not a one off question.

white mauve
# fierce tinsel r/woosh

Hi, I have isolated the code to reproduce the issue to avoid the potential of the issue being bad code from my side - you can see the video demonstration below:
https://share.getcloudapp.com/o0u91X89

Also you can see the Nova action below:
https://gist.github.com/HeadStudios/c6d7729a7f1e5f22c272a087f7ace815

And the FreshAttacherProcess job below:
https://gist.github.com/HeadStudios/daa2b85018bdf41ea3d306270ce5c353

I believe this eliminates the potential of this being my environment or my other bad code - if there is any input or anything else for me to check or review it would be much appreciated.

Thank you!

Gist

GitHub Gist: instantly share code, notes, and snippets.

Gist

GitHub Gist: instantly share code, notes, and snippets.

#

Update: I can confirm adding the following code:

    public function middleware()
{
    return [new WithoutOverlapping($this->contact->id)];
}

to the job has allowed me to now execute up to 7 jobs - which is an improvement however still short of all the jobs that are being dispatched.

Any other input much appreciated.

Updated code:
https://gist.github.com/HeadStudios/b135105b563d4b9650733dffcb11d84a

Gist

GitHub Gist: instantly share code, notes, and snippets.

#

UPDATE: I have created throttling based on documentation available here and adding the RateLimiter job middleware:
https://laravel.com/docs/9.x/queues#job-middleware

The updated code can be found below:
https://gist.github.com/HeadStudios/70df6fff92c476c26cca049dda9bfd64

I can now confirm that all jobs are run however some fail with the error being:

[2023-01-30 14:02:07] local.ERROR: App\Jobs\FreshAttacherProcess has been attempted too many times or run too long. The job may have previously timed out. {"exception":"[object] (Illuminate\\Queue\\MaxAttemptsExceededException(code: 0): App\\Jobs\\FreshAttacherProcess has been attempted too many times or run too long. The job may have previously timed out. at /home/forge/dev1.rrdevours.monster/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:746)
[stacktrace]

And there are quite a few in the error log:
https://gist.github.com/HeadStudios/45f2877d9f4a3e7d6072ff3b27f91308

My last attempt in getting jobs to run would be to delay job output by 5 seconds on each job - any input on why this happening would be much appreciated.
P.S. Please refer to specific issues and answeres rather than generic "Your code is bad" feedback

Gist

GitHub Gist: instantly share code, notes, and snippets.

Gist

GitHub Gist: instantly share code, notes, and snippets.

Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.