Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bootfi's avatar

laravel horizon jobs stuck in pending

Hi all,

I am writing to report a bug related to the job processing in Laravel Horizon. Specifically, I have encountered a situation where a job appears to be stuck in the "pending" status despite having a "completed_at" timestamp, and another job is stuck in the "reserved" status without progressing further.

Here are the details of the problematic jobs:

Job with "pending" status but "completed_at" : "status": "pending", "completed_at": "1685113859.5327", "reserved_at": "1685113859.5284",

Job with "reserved" status : "status": "reserved", "completed_at": null, "reserved_at": "1685110558.3953",

In the first case, the job has a "completed_at" timestamp indicating its successful completion, but it remains in the "pending" status. On the other hand, the second job is stuck in the "reserved" status without progressing further.

Could you please investigate this issue and provide guidance on how to resolve it? It seems that the job statuses are not being updated correctly, causing confusion in monitoring and processing.

Thank you for your attention to this matter. I look forward to your response and assistance in resolving this bug.

Best regards, khalid

0 likes
4 replies
LaryAI's avatar
Level 58

This issue could be caused by a number of factors, including a misconfiguration of the Horizon worker or a bug in the job code itself. Here are a few steps to try to resolve the issue:

  1. Check the Horizon worker configuration to ensure that it is set up correctly. Make sure that the worker is running and that it is connected to the correct Redis instance. You can also try restarting the worker to see if that resolves the issue.

  2. Check the job code to ensure that it is not causing any errors or exceptions that could be preventing it from completing. You can try running the job manually to see if it completes successfully.

  3. Check the Redis instance to ensure that it is functioning correctly. You can try connecting to Redis using a Redis client and checking the status of the job queues.

  4. If none of the above steps resolve the issue, you may need to debug the Horizon code itself. You can try adding logging statements to the Horizon code to see where the job processing is getting stuck.

Here is an example of how to manually run a job in Laravel:

php artisan queue:work --once --queue=your-queue-name

This will run a single job from the specified queue and exit. You can use this command to test the job code and see if it is completing successfully.

maslennikovyv's avatar

in my case there was no development environment in horizon.php

"You should ensure that the environments portion of your horizon configuration file contains an entry for each environment on which you plan to run Horizon"

4 likes
bluekable's avatar

I had a similar problem. Jobs seemed to stay in pending and get processed very arbitrarily, dashboard seemed off as well.

It seems horizon needed to be using the same redis connection as the queue.

We had split domains a bit, so default was a connection that used redis DB 0, Session used redis DB 5 and Cache used Redis DB 10.

At first we put Horizon on default via it's 'use' => 'default' config and we had the queue on it's own connection using DB 2.

Once we put them both on default connection using DB 0 it worked as expected.

Please or to participate in this conversation.