Unable to access admin after upgrade to 4.2 from 4.0

Your software
My Mautic version is: 4.2
My PHP version is: 7.4.3
My Database type and version is: MySQL 8.0.22-0ubuntu0.20.04.2

Your problem
My problem is:

Hello guys, I’m unable to access anymore to my GUI dashboard admin.
I have more than 140k contacts. APIs still seems to work, but everytime that I try to login, the dashboard is not loading.

I started the upgrade from 4.0 to 4.2 from the web interface and then ending with shell commands (migrations, etc.) as explained here: Mautic update failed - how to recover | Mautic)

After the update I also purged my db with these commands as always do every month. Now it’s around 9gb~

UPDATE email_stats SET tokens = '' WHERE date_sent < (NOW() - INTERVAL 15 DAY);
ANALYZE TABLE email_stats;
OPTIMIZE LOCAL TABLE email_stats;

DELETE FROM `lead_event_log` WHERE `object` LIKE 'segment' AND `action` LIKE 'added' AND date_added < (NOW() - INTERVAL 30 DAY);
DELETE FROM `lead_event_log` WHERE `object` LIKE 'segment' AND `action` LIKE 'removed' AND date_added < (NOW() - INTERVAL 30 DAY);
ANALYZE TABLE lead_event_log;
OPTIMIZE LOCAL TABLE lead_event_log;

DELETE FROM `lead_event_log` WHERE `object` LIKE 'campaign' AND `action` LIKE 'added' AND date_added < (NOW() - INTERVAL 30 DAY);
DELETE FROM `lead_event_log` WHERE `object` LIKE 'campaign' AND `action` LIKE 'removed' AND date_added < (NOW() - INTERVAL 30 DAY);
ANALYZE TABLE lead_event_log;
OPTIMIZE LOCAL TABLE lead_event_log;

DELETE FROM `email_stats_devices` WHERE date_opened < (NOW() - INTERVAL 30 DAY);
ANALYZE TABLE email_stats_devices;
OPTIMIZE LOCAL TABLE email_stats_devices;

TRUNCATE campaign_lead_event_failed_log;

DELETE from campaign_lead_event_log WHERE `event_id` IN (111,133,744, 719, 703, 745, 720, 704, 747, 722, 706, 749, 574, 575, 577, 580, 582, 584, 586, 587, 590, 592, 594,595, 597, 599, 601,603,606,607) AND date_triggered < (NOW() - INTERVAL 15 DAY);

DELETE from campaign_lead_event_log WHERE `event_id` IN (211,124,212,213,131,86,182,216,691,697,649,573,572) AND date_triggered < (NOW() - INTERVAL 30 DAY);

ANALYZE TABLE campaign_lead_event_log;
OPTIMIZE LOCAL TABLE campaign_lead_event_log;

What shall I do to restore my GUI mautic dashboard?

These are a mix of errors that I received in these two days debugging and trying to resolve, but I’m unable to replicate it now. Maybe you can find something more relavant or guide me to find something relevant to solve.

[Fri Mar 25 04:40:50.446421 2022] [php7:notice] [pid 1925] [client 74.125.209.41:61613] Doctrine\\DBAL\\DBALException: An exception occurred while establishing a connection to figure out your platform version.\nYou can circumvent this by setting a 'server_version' configuration value\n\nFor further information have a look at:\nhttps://github.com/doctrine/DoctrineBundle/issues/673 - in file /var/www/mautic/vendor/doctrine/doctrine-bundle/ConnectionFactory.php - at line 134

----

[2022-03-24 23:37:27] mautic.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\Exception\DeadlockException: "An exception occurred while executing 'UPDATE leads SET date_modified = ?, last_active = ? WHERE id = ?' with params ["2022-03-24 23:37:27", "2022-03-24 23:37:26", "353534"]:

SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction" at /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php line 51 {"exception":"[object] (Doctrine\\DBAL\\Exception\\DeadlockException(code: 0): An exception occurred while executing 'UPDATE leads SET date_modified = ?, last_active = ? WHERE id = ?' with params [\"2022-03-24 23:37:27\", \"2022-03-24 23:37:26\", \"353534\"]:

SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:51, Doctrine\\DBAL\\Driver\\PDO\\Exception(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18, PDOException(code: 40001): SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:112)
[stacktrace]
#0 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(182): Doctrine\\DBAL\\Driver\\AbstractMySQLDriver->convertException()
#1 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(159): Doctrine\\DBAL\\DBALException::wrapException()
#2 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(2212): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery()
#3 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1524): Doctrine\\DBAL\\Connection->handleExceptionDuringQuery()
#4 /var/www/mautic/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1473): Doctrine\\DBAL\\Connection->executeStatement()
#5 /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(512): Doctrine\\DBAL\\Connection->executeUpdate()
#6 /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(399): Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister->updateTable()
#7 /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(1209): Doctrine\\ORM\\Persisters\\Entity\\BasicEntityPersister->update()
#8 /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php(429): Doctrine\\ORM\\UnitOfWork->executeUpdates()
#9 /var/www/mautic/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(378): Doctrine\\ORM\\UnitOfWork->commit()
#10 /var/www/mautic/app/bundles/LeadBundle/Entity/CustomFieldRepositoryTrait.php(265): Doctrine\\ORM\\EntityManager->flush()
#11 /var/www/mautic/app/bundles/CoreBundle/Model/FormModel.php(111): Mautic\\LeadBundle\\Entity\\LeadRepository->saveEntity()
#12 /var/www/mautic/app/bundles/LeadBundle/Model/LeadModel.php(545): Mautic\\CoreBundle\\Model\\FormModel->saveEntity()
#13 /var/www/mautic/app/bundles/PointBundle/Model/PointModel.php(326): Mautic\\LeadBundle\\Model\\LeadModel->saveEntity()
#14 /var/www/mautic/app/bundles/EmailBundle/EventListener/PointSubscriber.php(107): Mautic\\PointBundle\\Model\\PointModel->triggerAction()
#15 /var/www/mautic/vendor/symfony/event-dispatcher/EventDispatcher.php(304): Mautic\\EmailBundle\\EventListener\\PointSubscriber->onEmailOpen()
#16 /var/www/mautic/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Symfony\\Component\\EventDispatcher\\EventDispatcher::Symfony\\Component\\EventDispatcher\\{closure}()
#17 /var/www/mautic/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\\Component\\EventDispatcher\\EventDispatcher->doDispatch()
#18 /var/www/mautic/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\\Component\\EventDispatcher\\EventDispatcher->callListeners()
#19 /var/www/mautic/app/bundles/EmailBundle/Model/EmailModel.php(552): Symfony\\Component\\EventDispatcher\\EventDispatcher->dispatch()
#20 /var/www/mautic/app/bundles/EmailBundle/Controller/PublicController.php(111): Mautic\\EmailBundle\\Model\\EmailModel->hitEmail()
#21 /var/www/mautic/vendor/symfony/http-kernel/HttpKernel.php(158): Mautic\\EmailBundle\\Controller\\PublicController->trackingImageAction()
#22 /var/www/mautic/vendor/symfony/http-kernel/HttpKernel.php(80): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
#23 /var/www/mautic/vendor/symfony/http-kernel/Kernel.php(201): Symfony\\Component\\HttpKernel\\HttpKernel->handle()
#24 /var/www/mautic/app/AppKernel.php(115): Symfony\\Component\\HttpKernel\\Kernel->handle()
#25 /var/www/mautic/app/middlewares/CORSMiddleware.php(91): AppKernel->handle()
#26 /var/www/mautic/app/middlewares/CatchExceptionMiddleware.php(43): Mautic\\Middleware\\CORSMiddleware->handle()
#27 /var/www/mautic/app/middlewares/VersionCheckMiddleware.php(67): Mautic\\Middleware\\CatchExceptionMiddleware->handle()
#28 /var/www/mautic/app/middlewares/TrustMiddleware.php(51): Mautic\\Middleware\\VersionCheckMiddleware->handle()
#29 /var/www/mautic/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Mautic\\Middleware\\TrustMiddleware->handle()
#30 /var/www/mautic/vendor/stack/run/src/Stack/run.php(13): Stack\\StackedHttpKernel->handle()
un()/var/www/mautic/index.php(24): Stack\
#32 {main}
"} 

Steps:

  1. Upgrade mautic to 4.2
  2. Clean up my db
  3. My dashboard is not accessible anymore.

Keep in mind that I stopped every cronjob to isolate the problem. The only thing that is working now is the API since I can see that “/var/www/mautic/var/logs/mautic_prod-2022-03-25.php” is still populating with debug messages from APIs calls.

Keep in mind that I deleted the cache several times. I really don’t know what do to get my GUI back, up & running.

Do you have any ideas of what steps I can do to intercept what is happening when I’m trying to login in the dashboard? Debug mode is not helping…

Any feedback is appreciated.