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

dixitchopra's avatar

Database Queue - Reserved problem

I am using Database Queue. I am able to see 1 in Reserved column. Can someone please tell me why does it go to reserved column?

Even my server gets hang in the middle. I don't know whether it's because of reserved queue or hanging is causing job to go to reserved state.

0 likes
11 replies
BENderIsGr8te's avatar

There really isn't enough information provided to answer the question. What are you trying to achieve? What columns do you have in the table? What is the name of the table? What data are you trying to input into the table? What code are you using to make the input that is causing the Reserved?

UPDATE

What version of Laravel are you using? What is your queue system (redis, beanstalkd?) how are you handling the queued job (which artisan command), and finally what is your development system? Vagrant? Max with built in server? Windows?

dixitchopra's avatar

I am using Database queue. I am using Ubuntu in AWS. Sometimes jobs are working fine and sometimes it moves to Reserved state. I want to know when does it go to reserved state and what causes it?

BENderIsGr8te's avatar

I actually don't know what "Reserved State" is. Is it a database thing? Is it specific to AWS? Is it a Laravel thing? That's why I wanted some code samples so I could start to understand your problem more. Knowing nothing about your app and not knowing what Reserved State means, I really can't answer. If you can provide more details about what your app is doing and some code paste of either errors, or success, or code, or screen shots of the problem I will try to help. Otherwise perhaps someone else has more experience with this specific problem and can help.

jekinney's avatar

Usually it will move to reserve if there is an error and the default number of tries is up or your queue listener isn't running.

jekinney's avatar

@BENderIsGr8te can be depending on the code if it throws an error. For testing at least you want to make sure queries get logged. More details will be out put in the log file.

dixitchopra's avatar

It doesn't throw an error. Job just goes to Reserved state.

jekinney's avatar

Check your log file. If there is no log referencing your queue set it up to log each after each attempt.

dixitchopra's avatar

In Terminal, I am writing this

php artisan queue:listen --timeout=0
BENderIsGr8te's avatar

@dixitchopra by default --tries=0 if you don't specify it when calling queue:listen. I always set --tries=2 so that after a few attempts it fails properly and I can then deal with the failed job. In practice seeing anything to zero in Artisan is a way of saying "no limit". That may cause unexpected issues. The default value of --timeout if you don't set it is 60 seconds, so I would leave it blank or set a reasonable specific amount depending on how long the job needs.

Depending on the job, try something like this

php artisan queue:listen --tries=2

See what results you get with that command.

imqqmi's avatar

Late to the party, but I ran into this myself. I think the reserved_at gets used when the job is starting to be processed, ie as an indication that it's being processed I think. If the queue:work or queue:listen is interrupted, a job can hang in that state and doesn't get reprocessed unless you set the reserved_at to NULL.

Please or to participate in this conversation.