Matomo 4.0.5 upgrade crashed the server with too many 'max_user_connections'

I was trying to update to Matomo 4.0.5 in a self hosted server by clicking the button “Continue to Matomo”.

It crashed the server with too many ‘max_user_connections’ active connections through

ALTER TABLE piwik_log_visit MODIFY COLUMN referer_url VARCHAR(1500) NULL;

Then I increased ‘max_user_connections’ from 50 to 150, but still the update process crashed the server again when it produced more 147 /analytics/piwik.php processes seen with “ps”.

My piwik_log_visit is 1,732,368 rows, Index Length 155.75 MB Data Length 225.50 MB. There are much bigger piwik tables in the database.

Seems something goes rogue, any idea?

Hi,

One rough guess: Could it be that the update query blocks the table until it is finished modifying which means that all tracking requests that are incoming in the meanwhile have to wait as they can’t write to the table. And if you don’t limit the number of PHP processes they increase until MySQL reaches the limit of clients connected to it.

If you don’t care about loosing the data in the meantime, you can simply disable tracking while you are updating: https://matomo.org/faq/how-to/faq_111/

If you do care you might want to use QueuedTracking to put the tracking requests during the update in a queue and process it afterwards:
https://matomo.org/faq/how-to-update/faq_20844/

https://matomo.org/faq/how-to-update/faq_20844/

1 Like

Thanks Lukas, it’s ok to lose the data for a little while.
Would you suggest to set both
record_statistics = 0
and
maintenance_mode = 1

1 Like