Shortly after midnight today, our MariaDB server began crashing on certain queries. For people requesting pages during one of these crashes, the site would fail to lookup your login cookie and mistakenly issue a new one; effectively logging you out.
After a bit of investigation, the problem looked like Visual Search Queries using up too much memory. mysqld was being killed with a signal 11.
I've reduced the key_buffer_size from 512MB to 256MB
set global key_buffer_size=268435456;
Which should buy us some time. It may be worth while to examine the indexes and global variables.
The other problem was code executing that should not have.
mysqli_real_connect() or die()
never actually dies!
I've rewritten the error handling in proper procedural, and it now correctly terminates at the first since of trouble.