Out of the blue DBA Exception - Mautic down

Your software
My Mautic version is: 4.x
My PHP version is: 7.4
My Database type and version is: mysql Ver 15.1 Distrib 10.3.34-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Your problem
My problem is:
This morning all of a sudden we had a number of our Mautic installations loose connection to their DB and showing site offline. It happened out of the blue - there were no server updates done, no mautic update.
Happened on servers running ubuntu on both DO and AWS

These errors are showing in the log:

https://github.com/doctrine/DoctrineBundle/issues/673 - in file /var/www/mautic/vendor/doctrine/doctrine-bundle/ConnectionFactory.php - at line 134" while reading response header from upstream, client: 71.6.232.7, server: mautic.domain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "123.123.123.123"
2022/03/01 07:11:09 [error] 2108352#2108352: *45 FastCGI sent in stderr: "PHP message: Doctrine\DBAL\DBALException: An exception occurred while establishing a connection to figure out your platform version.
You can circumvent this by setting a 'server_version' configuration value

Steps I have tried to fix the problem:
Tried to restart all services.
Looked around the internet for possible solutions.
Checked out relevant GitHub, there was also a closed issue posted on Mautic Github (An exception occurred while establishing a connection to figure out your platform version. · Issue #10729 · mautic/mautic · GitHub)
Spoke with @joeyk

Finally rebooted server. Took over 5 minutes for server to go up and down. After which everything resumed back to normal.

If anyone has any insight to the problem, how it can occur or why - would be great to know. Happy to assist with testing or doing any tasks.
Or if anyone knows where to set this server_version inside Mautic or on ubuntu

this is multiple MariaDB servers? or all Mautic instances connecting to the same?

all single instances on single servers.

I have just checked another server and it seems to be related to mysql.
When looking at the process’s running I noticed two for mysql.
I tried to restart mysqld and it just kind of hung, using systemctl restart.
tried to stop using systemctl and hung as well.
ran kill -9 on PID and this fixed the issue.

I am still in the dark as why this happened or would happen

Doctrine requires the DB version is specified:

I’ve just checked the file app/config/local.php and it seems it doesn’t specify the version.

@ekke , this is something Mautic should address, as it may cause issues like this in this issue.

@aerendir not sure why it would hit out of blue sky, though… any thoughts?

@aerendir we do not specify it in the local.php any more since Mautic 4.0.

Please reference the detailed writeup in this PR:

1 Like

So, maybe the detection doesn’t work well?

The error is clear: it requires the database version to be set, so somewhere in the process of setting the version there is an error.

Maybe this is a bug of Doctrine… I don’t know…

Hi folks I had the same issue. That’s what I made and what I had:

  1. I made a backup of Mautic (files and db)
  2. I copy all in a new server
  3. I gone to /app/config.php and correct all I need
    I had this error:

An exception occurred while establishing a connection to figure out your platform version.
You can circumvent this by setting a ‘server_version’ configuration value
For further information have a look at:
BC break between 1.6.7 -> 1.6.8 regarding driver selection · Issue #673 · doctrine/DoctrineBundle · GitHub

Than i tried:
‘db_server_version’ => ‘5.1’
‘db_server_version’ => ‘mariadb-10.3.27’
nothing change.
Can you help me?

Try and restart MySQL

Thanks @mikew, my customer is on a shared hosting, I’ll open a ticket let me try :wink:

Running Mautic on a “shared hosting” plan is trouble looking for a place to happen. One of the newest examples in the upgrade from UI is going away in Mautic 5. Another is not being able to troubleshoot or run manual actions in the case of this issue. The “out of the blue” nature of this issue may be caused by a host restart of your VPS or the DB server.

1 Like

Thanks but not everyone can afford a personal server, the important thing is to be aware of it

Hey @antonio-lazzari

That is correct, however did you know that you can run a good version of Mautic on a $5 server/month. Not sure how much you are paying for shared hosting, but something to maybe bring up with your customer

1 Like

5$ server/month? where?

Lot of good options, best price/performance is:
UpCloud, Vultr, Linode, OVH (harder to use), DigitalOcean, Lightsail

2 Likes

Dears I finally solved it in this way:

  1. I installed mautic to the same version
  2. I have downloaded the old db in compatibility version mysql40
  3. I have uploaded the dump
  4. I updated the local.php file
  5. I updated to the recent version and did some small setups
    Now all working fine.
    The problem was due to the old hosting service that ruined the db when exporting
1 Like

Another good option for about 5 eur / month is contabo

1 Like

Love linode.