<p>I keep seeing a Craft 3 site with queue sticking and clearing the cache doesn't clear it.</p>

<p>I have been thru plugins fixed some errors and now it all comes down to same issues:</p>

<blockquote>
  <p>PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]</p>
</blockquote>

<p>The specifics are:</p>

<pre><code>    thrown in /home/mydomain/vendor/yiisoft/yii2/web/Response.php on line 366
[30-Oct-2019 19:21:47 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 413696 bytes) in /home/mydomain/vendor/  
yiisoft/yii2/db/Command.php on line 1290
[30-Oct-2019 19:21:47 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered   queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /home/mydomain/vendor/yiisoft/yii2/db/Command.php:1290
Stack trace:
#0 /home/mydomain/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement-&gt;execute()
#1 /home/mydomain/vendor/yiisoft/yii2/db/Command.php(1158): yii\db\Command-&gt;internalExecute('SELECT *\nFROM `...')
#2 /home/mydomain/vendor/yiisoft/yii2/db/Command.php(399): yii\db\Command-&gt;queryInternal('fetchAll', NULL)
#3 /home/mydomain/vendor/yiisoft/yii2/db/Query.php(237): yii\db\Command-&gt;queryAll()
#4 /home/mydomain/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query-&gt;all(NULL)
#5 /home/mydomain/vendor/craftcms/cms/src/services/Categories.php(125): yii\db\ActiveQuery-&gt;all()
#6 /home/mydomain/vendor/craftcms/cms/src/service in /home/mydomain/vendor/craftcms/cms/src/templates/_layouts/base.html on line 37
</code></pre>

<p>I am not sure how to resolve this. Any ideas?</p>

CC BY-SA 4.0
2020-02-21T06:42:09.007Z
I have the same issue with craft_templatecachequeries. It is already 1Gb.  Is no pending jobs. Any knowing solutions? Craftcms 3.4.7.1
Max Lazar
CC BY-SA 4.0
2020-02-21T10:07:40.857Z
Hey Max. I eventually solved this by removing certain cache tags in my templates. I started with menu navigation tags first then worked down to page level. Kinda puzzling and never got to the bottom of it other than Brads advice which was to start stripping them out.i
joomkit
CC BY-SA 4.0
2019-10-31T19:32:36.503Z
What job is it trying to complete when that happens?
Brad Bell
CC BY-SA 4.0
2019-11-01T14:00:50.737Z
It's always clearing template caches...
joomkit
CC BY-SA 4.0
2019-11-11T11:09:22.080Z
Is this still an issue? Does it happen on a different environment?
dmatthams
CC BY-SA 4.0
2019-11-12T16:07:24.040Z
It happens in production only (staging is on same server) - seems something to do with content requests and template creation but cant find any more useful errors
joomkit
CC BY-SA 4.0
2019-11-13T11:42:46.963Z
That's interesting, do you have cache enabled on production and disabled on staging? I've had mysterious errors with cache that were solved by increasing max_allowed_packet in my.conf. If not what else is enabled on production and not on staging?
dmatthams
CC BY-SA 4.0
2019-11-13T15:27:47.130Z
Now were' getting somewhere - 'craft_templatecachequeries' is running at 2 gig in size and not clearing which might be hard to clear in a background task. I noticed in production config that I'd set cacheElementQueries to true though its the cacheElementQueries table that is filling up, i wonder if this setting uses that table? I probably set it for performance reasons. This might be it
joomkit
<queue><stalled-tasks>
Craft queue keeps sticking despite 1GB memory allocation
# Craft queue keeps sticking despite 1GB memory allocation

(Asked by: username_0 on 2019-10-31)

I keep seeing a Craft 3 site with queue sticking and clearing the cache doesn't clear it.
I have been thru plugins fixed some errors and now it all comes down to same issues:

PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]

The specifics are:
    thrown in /home/mydomain/vendor/yiisoft/yii2/web/Response.php on line 366
[30-Oct-2019 19:21:47 UTC] PHP Fatal error:  Allowed memory size of 1610612736 bytes exhausted (tried to allocate 413696 bytes) in /home/mydomain/vendor/  
yiisoft/yii2/db/Command.php on line 1290
[30-Oct-2019 19:21:47 UTC] PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered   queries are active.  Consider using PDOStatement::fetchAll().  Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /home/mydomain/vendor/yiisoft/yii2/db/Command.php:1290
Stack trace:
#0 /home/mydomain/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement->execute()
#1 /home/mydomain/vendor/yiisoft/yii2/db/Command.php(1158): yii\db\Command->internalExecute('SELECT *\nFROM `...')
#2 /home/mydomain/vendor/yiisoft/yii2/db/Command.php(399): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /home/mydomain/vendor/yiisoft/yii2/db/Query.php(237): yii\db\Command->queryAll()
#4 /home/mydomain/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query->all(NULL)
#5 /home/mydomain/vendor/craftcms/cms/src/services/Categories.php(125): yii\db\ActiveQuery->all()
#6 /home/mydomain/vendor/craftcms/cms/src/service in /home/mydomain/vendor/craftcms/cms/src/templates/_layouts/base.html on line 37

I am not sure how to resolve this. Any ideas?

**Tags:** queue, stalled-tasks
> **Comments:**
> **username_2**: What job is it trying to complete when that happens?  
> **username_0**: It's always clearing template caches...  
> **username_3**: Is this still an issue? Does it happen on a different environment?  
> **username_0**: It happens in production only (staging is on same server) - seems something to do with content requests and template creation but cant find any more useful errors  
> **username_3**: That's interesting, do you have cache enabled on production and disabled on staging? I've had mysterious errors with cache that were solved by increasing max_allowed_packet in my.conf. If not what else is enabled on production and not on staging?  
> **username_0**: Now were' getting somewhere - 'craft_templatecachequeries' is running at 2 gig in size and not clearing which might be hard to clear in a background task. I noticed in production config that I'd set cacheElementQueries to true though its the cacheElementQueries table that is filling up, i wonder if this setting uses that table? I probably set it for performance reasons. This might be it  
> **username_1**: I have the same issue with craft_templatecachequeries. It is already 1Gb.  Is no pending jobs. Any knowing solutions? Craftcms 3.4.7.1  
> **username_0**: Hey Max. I eventually solved this by removing certain cache tags in my templates. I started with menu navigation tags first then worked down to page level. Kinda puzzling and never got to the bottom of it other than Brads advice which was to start stripping them out.i  

---

## 0 answers

