This happened twice in the last 2 days:
Oct 24 09:23:39 tools-db-1 systemd[1]: mariadb.service: A process of this unit has been killed by the OOM killer. Oct 24 09:23:39 tools-db-1 systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL Oct 24 09:23:39 tools-db-1 systemd[1]: mariadb.service: Failed with result 'oom-kill'.
Oct 25 09:52:46 tools-db-1 systemd[1]: mariadb.service: Main process exited, code=killed, status=9/KILL Oct 25 09:52:46 tools-db-1 systemd[1]: mariadb.service: Failed with result 'signal'. Oct 25 09:52:46 tools-db-1 systemd[1]: mariadb.service: Consumed 2d 17h 12min 12.958s CPU time. Oct 25 09:52:51 tools-db-1 systemd[1]: mariadb.service: Scheduled restart job, restart counter is at 1. Oct 25 09:52:51 tools-db-1 systemd[1]: Stopped mariadb database server. Oct 25 09:52:51 tools-db-1 systemd[1]: mariadb.service: Consumed 2d 17h 12min 12.958s CPU time. Oct 25 09:52:51 tools-db-1 systemd[1]: Starting mariadb database server...
Note how the error on Oct 25 is slightly different and doesn't mention OOM, but dmesg shows the reason was OOM in both instances:
[Tue Oct 24 09:19:23 2023] Out of memory: Killed process 2437 (mysqld) total-vm:64835688kB, anon-rss:64103256kB, file-rss:0kB, shmem-rss:0kB, UID:497 pgtables:126460kB oom_score_adj:-600 [Wed Oct 25 09:48:25 2023] Out of memory: Killed process 1853830 (mysqld) total-vm:67422936kB, anon-rss:64695060kB, file-rss:0kB, shmem-rss:0kB, UID:497 pgtables:128052kB oom_score_adj:-600
Another difference is that on Oct 25, systemctl did restart the unit automatically, while on Oct 24 it did not, and I had to manually systemctl start mariadb. In both cases I also had to manually enable read-write mode, as mariadb is configured to start in read-only mode.
A similar issue happened a few months ago: T344298: mysqld killed by oomkiller on tools-db-1.tools.eqiad1.wikimedia.cloud




