Answers.Body: <p>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 <a href="https://craftcms.com/support/stuck-tasks" rel="nofollow noreferrer">https://craftcms.com/support/stuck-tasks</a> (I blame the substandard laptop work have given me which grinds.)</p>
  
  <p>I've moved the system to a much better solution (GCP Instance) and the queue cleared in no time! </p>
  
  <p>Hopefully, no one else experiences this but this was what solved it for me so thought I best share.</p>
  
  <p>Thanks for the help in the mean time though.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-02T10:28:35.187Z
Answers.LastActivityDate: 2018-02-02T10:28:35.187Z
Answers.UserDisplayName: AdamPatPattison
Answers.Body: <p>I typically just truncate (delete all of the rows) the <code>queue</code> table if something goes wrong with a task.</p>
  
  <p>Then I delete all of the files in <code>storage/logs/</code> and I try to reproduce the problem. If it still happens, then I look in <code>queue.log</code> and <code>web.log</code> to see what the issue is.</p>
  
  <p>Usually searching on <code>[error]</code> 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.</p>
  
  <p>Relevant articles I wrote since this answer:</p>
  
  <ul>
  <li><a href="https://nystudio107.com/blog/robust-queue-job-handling-in-craft-cms" rel="nofollow noreferrer">Robust queue job handling in Craft CMS</a></li>
  <li><a href="https://nystudio107.com/blog/zen-and-the-art-of-craft-cms-log-file-reading" rel="nofollow noreferrer">Zen and the Art of Craft CMS Log File Reading</a></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-15T10:20:22.450Z
Answers.Text: Thanks, Andrew. I've tried Truncating the table and a new task has been created but is just hanging there again too.
Answers.UserDisplayName: AdamPatPattison
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-09T15:20:41.663Z
Answers.Text: Would be neat to have some kind of command to do this via the CP or CLI
Answers.UserDisplayName: James Greig
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-20T17:11:57.020Z
Answers.Text: I updated my answer to be a little more helpful.
Answers.UserDisplayName: andrew.welch
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-08T14:09:25.303Z
Answers.Text: 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?
Answers.UserDisplayName: darylknight
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-01-12T22:33:51.557Z
Answers.LastActivityDate: 2019-10-09T17:39:05.150Z
Answers.LastEditDate: 2019-10-09T17:39:05.150Z
Answers.UserDisplayName: andrew.welch
Answers.Body: <p>There is now a handy plugin available for managing your tasks queue:</p>
  
  <p><a href="https://github.com/lukeyouell/craft-queue-manager" rel="nofollow noreferrer">https://github.com/lukeyouell/craft-queue-manager</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-08T05:53:33.987Z
Answers.LastActivityDate: 2019-05-08T05:53:33.987Z
Answers.UserDisplayName: j00lz
Answers.Body: <p>Just in case anyone is still having issues after the above suggestions.</p>
  
  <p>Make sure that you have the following option in your <code>craft/config/general.php</code> config settings:</p>
  
  <pre><code>// run tasks auto
  'runTasksAutomatically' =&gt; true,
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-24T23:05:15.253Z
Answers.Text: `runTasksAutomatically` is the setting for Craft v2. The setting for Craft v3 is `runQueueAutomatically` and it defaults to true.
Answers.UserDisplayName: Jay Haase
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-20T16:53:36.330Z
Answers.LastActivityDate: 2018-09-20T16:53:36.330Z
Answers.UserDisplayName: tylerjwilk
Body: <p>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.</p>
  
  <p>I have tried updating the DB table "queue" by doing the following:</p>
  
  <p>1) Changing the <code>failed</code> field to 1 and <code>dateFailed</code> to NOW() thus marking the task as failed then clicking the retry option. This just puts the task back into the same routine.</p>
  
  <p>2) Changing both <code>dateReserved</code> and <code>timeUpdated</code> to NULL thus resetting the task and it go back into pending but this also doesn't help. </p>
  
  <p>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.</p>
  
  <p>I have attached my queue logs below for reference but I can't see anything unless I am missing something glaringly obvious!?</p>
  
  <p>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.</p>
  
  <p><a href="https://www.screencast.com/t/mqGDMkDT" rel="nofollow noreferrer">CP Screenshot</a></p>
  
  <p><a href="https://www.screencast.com/t/bDEkWVCE" rel="nofollow noreferrer">Database Screenshot</a></p>
  
  <p><a href="https://pastebin.com/kXMm8QJ6" rel="nofollow noreferrer">Queue.log</a></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-12T17:32:22.217Z
Comments.Text: 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: https://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`.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-15T10:20:52.260Z
Comments.Text: 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.
Comments.UserDisplayName: AdamPatPattison
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-15T22:27:33.363Z
Comments.Text: Anything related being logged in your web server's error logs or the general `craft/storage/logs` folder?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-16T13:56:13.683Z
Comments.Text: 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!
Comments.UserDisplayName: AdamPatPattison
Tags: <craft3><tasks><stalled-tasks>
Title: How can I troubleshoot why my queue of tasks in stuck in Craft 3?
ThreadText: # How can I troubleshoot why my queue of tasks in stuck in Craft 3?
  
  (Asked by: username_0 on 2018-01-12)
  
  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](https://www.screencast.com/t/mqGDMkDT)
  
  [Database Screenshot](https://www.screencast.com/t/bDEkWVCE)
  
  [Queue.log](https://pastebin.com/kXMm8QJ6)
  
  **Tags:** craft3, tasks, stalled-tasks
  
  > **Comments:**
  > **username_1**: 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: https://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`.  
  > **username_0**: Thanks username_1,  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.  
  > **username_1**: Anything related being logged in your web server's error logs or the general `craft/storage/logs` folder?  
  > **username_0**: Thanks username_1.   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!  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_0 on 2018-02-02. Score: 0 | Accepted answer
  
  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.
  
  
  ---
  
  ### Answer by username_2 on 2018-01-12. Score: 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:
  
  * [Robust queue job handling in Craft CMS](https://nystudio107.com/blog/robust-queue-job-handling-in-craft-cms)
  * [Zen and the Art of Craft CMS Log File Reading](https://nystudio107.com/blog/zen-and-the-art-of-craft-cms-log-file-reading)
  
  > **Comments:**
  > **username_0**: Thanks, Andrew. I've tried Truncating the table and a new task has been created but is just hanging there again too.  
  > **username_3**: Would be neat to have some kind of command to do this via the CP or CLI  
  > **username_2**: I updated my answer to be a little more helpful.  
  > **username_4**: 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?  
  
  ---
  
  ### Answer by username_5 on 2019-05-08. Score: 3
  
  There is now a handy plugin available for managing your tasks queue:
  
  <https://github.com/lukeyouell/craft-queue-manager>
  
  
  ---
  
  ### Answer by username_6 on 2018-09-20. Score: 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,
  
  ```
  
  > **Comments:**
  > **username_7**: `runTasksAutomatically` is the setting for Craft v2. The setting for Craft v3 is `runQueueAutomatically` and it defaults to true.  
  
  ---
  
  