MySQL Crash on Archive

We’ve recently upgraded to 4.2.1 from 4.1.0.

Since then, we’ve been seeing our MySQL Galera cluster die regularly and we’ve finally been able to pin point this to Matomo as the cause from the archive task.

/usr/bin/php /var/www/m/console core:archive --url=https://x.x.x.x/

If we run manually, it also causes this.

The last query that errored was:

Mar 22 11:05:04 db02 mariadbd[7332]: Query (0x7fd79c01c3b0): UPDATE matomo_archive_numeric_2020_12 SET value = 4 WHERE name LIKE 'done%'
Mar 22 11:05:04 db02 mariadbd[7332]:                    AND idsite IN (1, 2, 3, 4, 5, 6, 8, 10, 11, 13, 16, 22, 25, 31, 34, 46, 49, 70)
Mar 22 11:05:04 db02 mariadbd[7332]:                    AND ((period = 5 AND ((date1 <= '2020-12-01' AND '2020-12-01' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-01' AND '2020-12-31' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-02' AND '2020-12-02' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-03' AND '2020-12-03' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-04' AND '2020-12-04' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-05' AND '2020-12-05' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-06' AND '2020-12-06' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-07' AND '2020-12-07' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-07' AND '2020-12-13' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-08' AND '2020-12-08' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-09' AND '2020-12-09' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-10' AND '2020-12-10' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-11' AND '2020-12-11' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-12' AND '2020-12-12' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-13' AND '2020-12-13' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-14' AND '2020-12-14' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-14' AND '2020-12-20' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-15' AND '2020-12-15' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-16' AND '2020-12-16' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-17' AND '2020-12-17' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-18' AND '2020-12-18' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-19' AND '2020-12-19' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-20' AND '2020-12-20' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-21' AND '2020-12-21' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-21' AND '2020-12-27' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-22' AND '2020-12-22' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-23' AND '2020-12-23' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-24' AND '2020-12-24' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-25' AND '2020-12-25' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-26' AND '2020-12-26' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-27' AND '2020-12-27' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-28' AND '2020-12-28' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-28' AND '2021-01-03' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-29' AND '2020-12-29' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-30' AND '2020-12-30' <= date2))) OR (period = 5 AND ((date1 <= '2020-12-31' AND '2020-12-31' <= date2))))
Mar 22 11:05:04 db02 mariadbd[7332]: Connection ID (thread ID): 1794

We’ve also ruled out a single node as the issue, when db02 was down. We ran again and then it took db01 down.

This has been running well for over a year now but to the hour when the upgrade was done, this has been happening. The only solution we’ve had is to stop the archive task but longer term, a workable solution is needed.

Hi,

If MySQL crashes on an SQL query then this has to be a bug in MySQL (or your setup).

For example there was recently a bug in one version of MariaDB that caused it to crash in some Matomo queries.

Maybe check if you are using the latest patch version of MySQL. I unfortunatly don’t know MySQL well enough to be able to help more.

Thank you.

Looks like we’ve had nothing running that kind of query to trigger it. I did have a search but couldn’t see anything.

Anyway, for now, I’ve applied that limit and it seems to be happier.