I've been developing on Drupal at work for some time, now I also have a hosted personal site (on fastcomet). The first install was with 8.6 and php 7.2, then it has been idle for a while, now I upgraded it to 8.9 with php 7.4. It works, but most often when I ran
drush cr it gives me me the classic (and dreaded) "General error 2014":
In Connection.php line 1210: 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.
Occasionally it works, but then if I open any page of the site it tells me "SQL server has gone away". So, it seems that if the site is using the database drush cannot reach it, and vice versa.
I would gladly enable query buffering, but if I understand correctly I should do it in the code in core, right? Also, I would gladly ask for help from fastcomet's support (they are quite willing and well-meaning, but not very helpful when you ask something outside their knowledge base), but I wouldn't know what to ask... not yet, at least.
Here is the output of
drush cr -vvv, just to provide more context:
[oneiroit@de15 dr]$ ./vendor/bin/drush cr -vvv [preflight] Config paths: /home/oneiroit/public_html/dr/vendor/drush/drush/drush.yml [preflight] Alias paths: /home/oneiroit/public_html/dr/web/drush/sites,/home/oneiroit/public_html/dr/drush/sites [preflight] Commandfile search paths: /home/oneiroit/public_html/dr/vendor/drush/drush/src [debug] Starting bootstrap to site [0.11 sec, 8.14 MB] [debug] Drush bootstrap phase 2 [0.11 sec, 8.14 MB] [debug] Try to validate bootstrap phase 2 [0.11 sec, 8.14 MB] [debug] Try to validate bootstrap phase 2 [0.11 sec, 8.14 MB] [debug] Try to bootstrap at phase 2 [0.11 sec, 8.14 MB] [debug] Drush bootstrap phase: bootstrapDrupalRoot() [0.11 sec, 8.14 MB] [debug] Change working directory to /home/oneiroit/public_html/dr/web [0.11 sec, 8.14 MB] [debug] Initialized Drupal 8.9.11 root directory at /home/oneiroit/public_html/dr/web [0.11 sec, 8.27 MB] [debug] Try to validate bootstrap phase 2 [0.11 sec, 8.27 MB] [debug] Try to bootstrap at phase 2 [0.12 sec, 8.62 MB] [debug] Drush bootstrap phase: bootstrapDrupalSite() [0.12 sec, 8.62 MB] [debug] Initialized Drupal site default at sites/default [0.12 sec, 8.8 MB] In Connection.php line 1210: [PDOException (HY000)] 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. Exception trace: at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/Database/Connection.php:1210 PDO->beginTransaction() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/Database/Connection.php:1210 Drupal\Core\Database\Connection->pushTransaction() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/Database/Transaction.php:65 Drupal\Core\Database\Transaction->__construct() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/Database/Connection.php:1118 Drupal\Core\Database\Connection->startTransaction() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php:80 Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->menuLinksRebuild() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php:71 Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber->onRouterRebuild() at n/a:n/a call_user_func() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php:111 Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() at /home/oneiroit/public_html/dr/web/core/lib/Drupal/Core/Routing/RouteBuilder.php:197 Drupal\Core\Routing\RouteBuilder->rebuild() at /home/oneiroit/public_html/dr/web/core/includes/common.inc:1090 drupal_flush_all_caches() at /home/oneiroit/public_html/dr/web/core/includes/utility.inc:55 drupal_rebuild() at /home/oneiroit/public_html/dr/vendor/drush/drush/src/Commands/core/CacheCommands.php:234 Drush\Commands\core\CacheCommands->rebuild() at n/a:n/a call_user_func_array() at /home/oneiroit/public_html/dr/vendor/consolidation/annotated-command/src/CommandProcessor.php:257 Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() at /home/oneiroit/public_html/dr/vendor/consolidation/annotated-command/src/CommandProcessor.php:212 Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() at /home/oneiroit/public_html/dr/vendor/consolidation/annotated-command/src/CommandProcessor.php:178 Consolidation\AnnotatedCommand\CommandProcessor->process() at /home/oneiroit/public_html/dr/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:302 Consolidation\AnnotatedCommand\AnnotatedCommand->execute() at /home/oneiroit/public_html/dr/vendor/symfony/console/Command/Command.php:255 Symfony\Component\Console\Command\Command->run() at /home/oneiroit/public_html/dr/vendor/symfony/console/Application.php:1005 Symfony\Component\Console\Application->doRunCommand() at /home/oneiroit/public_html/dr/vendor/symfony/console/Application.php:255 Symfony\Component\Console\Application->doRun() at /home/oneiroit/public_html/dr/vendor/symfony/console/Application.php:148 Symfony\Component\Console\Application->run() at /home/oneiroit/public_html/dr/vendor/drush/drush/src/Runtime/Runtime.php:118 Drush\Runtime\Runtime->doRun() at /home/oneiroit/public_html/dr/vendor/drush/drush/src/Runtime/Runtime.php:49 Drush\Runtime\Runtime->run() at /home/oneiroit/public_html/dr/vendor/drush/drush/drush.php:72 require() at /home/oneiroit/public_html/dr/vendor/drush/drush/drush:4 cache:rebuild [--cache-clear [CACHE-CLEAR]] [--no-cache-clear] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--notify [NOTIFY]] [--xh-link XH-LINK] [--druplicon] [--] <command>
EDIT: at the moment I am bypassing the problem by clearing the cache from the web interface, yet it's very annoying to be unable to use drush. Also, I am not sure what will happen when (if) I'll give access to my site to other people, at the moment I am the only active user...