I am trying to remove revisions from each entity type which has the revision feature via drush command. The amount of entities are quite a lot: around 10K nodes, 2k paragraphs.

On localhost everything is fine. But in the cloud the drush_print($log) successfully runs and the following error appears:

 [warning] PDO::beginTransaction(): MySQL server has gone away Connection.php:1165
 [warning] PDO::beginTransaction(): Error reading result set's header Connection.php:1165

In Connection.php line 1165:

  SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

The two environments are close to identical. Any suggestions where could I start to investigate?

  • You could do a diff on each environments php.ini and my.cnf.
    – leymannx
    Jan 14, 2020 at 14:24
  • Well here is a work around. Backup of live site, put live site in maintenance mode, import backup to local, do your clean up on local and then upload db to live site.
    – No Sssweat
    Jan 15, 2020 at 11:36
  • Additional information request. RAM size, # cores, any SSD devices on MySQL Host server? Post on pastebin.com and share the links. From SSH login root, Text results of: B) SHOW GLOBAL STATUS; after minimum 24 hours UPTIME C) SHOW GLOBAL VARIABLES; E) complete MySQLTuner report for server workload tuning analysis to provide suggestions. Jan 15, 2020 at 18:54
  • What method are you removing revisions from entities?
    – mradcliffe
    Jan 31, 2020 at 2:10
  • @ssibal Any chance you can post additional information requested Jan 15, 2020? Mar 6, 2020 at 18:29

1 Answer 1


It turned out what the real issue was. I didn't mention (thought it's not important) that this was actually a Drush command pointing to another multi site.

The actions took "too long" on the other site and by the time it returned with success, the default Mysql connection was timed out and couldn't write to the database anymore. (even tho the corresponding Mysql timeout settings were way higher than the actual amount of time that was spent on the other site)

We solved with with

$process = proc_open($command, [STDIN, STDOUT, STDERR], $pipes);
if (!is_resource($process)) {
  throw new \InvalidArgumentException("Could not execute `{$command}`.");
while (($status = proc_get_status($process)) && ($status['running'])) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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