"2006 MySQL server has gone away"; Can't enable and upgrade framework on HA

Framework is disabled and can’t be upgraded or enabled. (13.0.137 to 13.0.153). FreePBX distro.

fwconsole ma upgradeall
Upgrading framework…
Starting framework download…
Processing framework
Verifying local module download…Verified
Extracting…Done
Module framework successfully downloaded
installing files to /var/www/html…done
installing files to /var/lib/asterisk/bin…done
installing files to /var/lib/asterisk/agi-bin…done
Checking for upgrades…
1 found
Upgrading to 13.0.143…
-> Running PHP script /drbd/httpd/www/html/admin/modules/framework/upgrades//13.0.143/upgrade.php

Here the upgrade hangs for about 20 minutes, taking up the entire memory of the machine.
Then:

[PDOException]
_ SQLSTATE[HY000]: General error: 2006 MySQL server has gone away_

ma [-f|–force] [-d|–debug] [–edge] [–color] [–skipchown] [-e|–autoenable] [–skipdisabled] [–format="…"] [-R|–repo="…"] [args1] … [argsN]

_ [PDOException]_
_ SQLSTATE[HY000]: General error: 2006 MySQL server has gone away_

ma [-f|–force] [-d|–debug] [–edge] [–color] [–skipchown] [-e|–autoenable] [–skipdisabled] [–format="…"] [-R|–repo="…"] [args1] … [argsN]

Upgrading to 13.0.143…OK

_ [PDOException]_
_ SQLSTATE[HY000]: General error: 2006 MySQL server has gone away_

ma [-f|–force] [-d|–debug] [–edge] [–color] [–skipchown] [-e|–autoenable] [–skipdisabled] [–format="…"] [-R|–repo="…"] [args1] … [argsN]

I ran into this issue just now, the upgrade process seemed be getting stuck at the intermediate transition to 13.0.143, looping indefinitely. I believe the mysqld issues you see are a consequence of running out of memory.

I was able to fix by running ‘fwconsole chown’ and using Module Admin in the GUI to rollback to Framework 13.0.142. At this point a normal upgradeall worked.

How do you rollback the framework? I’m hung too trying to upgrade. It says it’s trying to upgrade to 13.0.153

My system says 13.0.137 is installed, it says it’s trying to upgrade to 13.0.153 but the PHP script says 13.0.143 and it just hangs during running the PHP script.

Had same problem here. Go to FreePBX GUI Module administration, click “Check online”, then go to “FreePBX Framework” and under previous you can “rollback” to 13.0.142. And then upgrade to .153.
I was slightly confused that I could rollback to .142 despite seemingly still being on .137.
However it worked. (I think I was on .143 after the first upgrade attempt, the GUI was incorrectly showing that I was still on version .137 however).

Ahhh got it!! Thanks!!