Dennis
Dennis

Reputation: 288

Laravel job stays in "Processing" state although finished

I have a problem with the laravel queue system. For performance purposes we use laravel queuing system with amazons SQS for heavier calculations. This works fine at least for most of our jobs. Some of them where the raw calculation time is about 25 seconds keep blocking the queue in the "Procesing" state for 6 minutes.

We did log the complete handle function of the job and the output was right at any time. As a matter of fact the last log statement (end of the function) was printed 20 seconds after entering the function. The data was calculated as expected and the database was up to date but the job was still "Processing".

enter image description here

After we intentionally crashed the job at the end of the handle function the calculated data was stored perfectly but obviously the queue crashed as well. So i guess it has to be something happing after the handle function. Maybe something with allocated memory?

The config of the queue is the default sqs driver configuration:

'sqs' => array(
    'driver' => 'sqs',
    'key'    => env('AWS_KEY', 'secret'),
    'secret' => env('AWS_SECRET', 'secret'),
    'queue'  => env('AWS_SQS_QUEUE', 'secret'),
    'region' => env('AWS_SQS_REGION', 'secret'),
),

Edit: I found out it is not only the queue but when I execute the job as a command the same behavior appears:

I print "Done." as the last statement in the command and after it gets printed the console halts for a few seconds before returning to the console input.

enter image description here

When I comment out the part where the most queries are the issue is gone, like the more queries I use the more I have to wait for the console.

I hope any of you guys know what causes this behavior and how we can fix it.

Thanks in advance

Upvotes: 2

Views: 746

Answers (1)

Dennis
Dennis

Reputation: 288

Ok I found the issue.

The problem was that telescope was enabled. So after the code was executed telescope was busy logging all requests and cache hits.

After disabling telescope there was no delay any more.

Upvotes: 5

Related Questions