2

I have a series of tasks lined up in the queue to run but they are just marking one as in progress and then sitting there and not executing.

I have tried updating the DB table "queue" by doing the following:

1) Changing the failed field to 1 and dateFailed to NOW() thus marking the task as failed then clicking the retry option. This just puts the task back into the same routine.

2) Changing both dateReserved and timeUpdated to NULL thus resetting the task and it go back into pending but this also doesn't help.

I'm trying to debug the cause of this but getting lost in the code as it seems the QueueController is setting everything as it should be but then either not getting a response and updating the progress or it's failing silently somewhere along the way.

I have attached my queue logs below for reference but I can't see anything unless I am missing something glaringly obvious!?

I asked on the #craft3 Slack channel and got some help but nothing worked. Hopefully, we can find a solution on here and share with others.

CP Screenshot

Database Screenshot

Queue.log

  • The reasons a job would fail in Craft 3 are nearly identical to the reasons a task would fail in Craft 2, although debugging them are slightly different: craftcms.com/support/stuck-tasks Is it consistently stalling on the same job or randomly? I don't see anything in your queue.log, but if it's a fatal error it'll either be logged in your web server's error logs or craft/storage/logs/phperrors.log. – Brad Bell Jan 12 '18 at 17:32
  • Thanks Brad, It's stalling on any and all jobs at the moment. There is nothing I can see in the phperror log either!? I have increased the max_execution_time as per the link (which I had already done anyway) to 300. I am still getting issues. – AdamPatPattison Jan 15 '18 at 10:20
  • Anything related being logged in your web server's error logs or the general craft/storage/logs folder? – Brad Bell Jan 15 '18 at 22:27
  • Thanks Brad. The only thing in the error logs is [15-Jan-2018 17:41:05 Europe/London] PHP Fatal error: Cannot use craft\base\Object as Object because 'Object' is a special class name in /home/vagrant/code/vendor/dolphiq/titleentriesfield/src/TitleEntriesFieldPlugin.php on line 24 so I've uninstalled the plugin. Still no joy, it very bizarre! – AdamPatPattison Jan 16 '18 at 13:56
7

I typically just truncate (delete all of the rows) the queue table if something goes wrong with a task.

Then I delete all of the files in storage/logs/ and I try to reproduce the problem. If it still happens, then I look in queue.log and web.log to see what the issue is.

Usually searching on [error] finds what I'm looking for pretty easily. Occasionally I have to browse through the file to find the actual problem, but that's why I delete the log files before I do it, so there isn't as much to wade through.

Relevant articles I wrote since this answer:

  • Thanks, Andrew. I've tried Truncating the table and a new task has been created but is just hanging there again too. – AdamPatPattison Jan 15 '18 at 10:20
  • Would be neat to have some kind of command to do this via the CP or CLI – James Greig May 9 '18 at 15:20
  • I updated my answer to be a little more helpful. – andrew.welch Sep 20 '18 at 17:11
  • I'm running into a few issues with a site's queue and I need to get rid of tasks that permanently fail. Is it still safe to just delete the rows in the queue table? When I try that, SequelPro asks if I want to reset AUTO_INCREMENT. Any idea? – darylknight Oct 8 at 14:09
3

There is now a handy plugin available for managing your tasks queue:

https://github.com/lukeyouell/craft-queue-manager

1

Just in case anyone is still having issues after the above suggestions.

Make sure that you have the following option in your craft/config/general.php config settings:

// run tasks auto
'runTasksAutomatically' => true,
  • runTasksAutomatically is the setting for Craft v2. The setting for Craft v3 is runQueueAutomatically and it defaults to true. – Jay Haase Feb 24 at 23:05
0

I solved this by updating my dev environment. I was running into these queue issues on my local vagrant setup and it was simply running so slow and timing out on each request for some reason. This was even with the suggested settings changed and checked as per https://craftcms.com/support/stuck-tasks (I blame the substandard laptop work have given me which grinds.)

I've moved the system to a much better solution (GCP Instance) and the queue cleared in no time!

Hopefully, no one else experiences this but this was what solved it for me so thought I best share.

Thanks for the help in the mean time though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.