how to make mariadb 5.5.30 consume all your memory and crash

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.30-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [test]> create table foo (id int primary key, modified datetime not null);
Query OK, 0 rows affected (0.11 sec)

MariaDB [test]> explain select a.* from foo a left join foo b on a.id=b.id where a.modified>b.modified or b.modified is null;
ERROR 2013 (HY000): Lost connection to MySQL server during query


Output of “show processlist” on another client:
Id: 1
User: root
Host: localhost
db: test
Command: Query
Time: 28
State: optimizing
Info: explain select a.* from foo a left join foo b on a.id=b.id where a.modified>b.modified or b.modified
Progress: 0.000


Okay, so it doesn’t actually “crash”:
Mar 13 12:47:14 localhost kernel: Out of memory: Kill process 10938 (mysqld) score 936 or sacrifice child
Mar 13 12:47:14 localhost kernel: Killed process 10938, UID 27, (mysqld) total-vm:1990268kB, anon-rss:416404kB, file-rss:16kB


Same test on mysql 5.5.30–no problem here:

mysql> create table foo (id int primary key, modified datetime not null);
Query OK, 0 rows affected (0.09 sec)

mysql> status
--------------
mysql Ver 14.14 Distrib 5.5.30, for Linux (x86_64) using readline 5.1

Connection id: 3
Current database: test
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.5.30 Distributed by The IUS Community Project
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 56 sec

Threads: 1 Questions: 14 Slow queries: 0 Opens: 34 Flush tables: 1 Open tables: 26 Queries per second avg: 0.250
--------------

mysql> explain select a.* from foo a left join foo b on a.id=b.id where a.modified>b.modified or b.modified is null;
+----+-------------+-------+--------+---------------+---------+---------+-----------+------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------+--------+---------------+---------+---------+-----------+------+-------------+
| 1 | SIMPLE | a | ALL | NULL | NULL | NULL | NULL | 1 | |
| 1 | SIMPLE | b | eq_ref | PRIMARY | PRIMARY | 4 | test.a.id | 1 | Using where |
+----+-------------+-------+--------+---------------+---------+---------+-----------+------+-------------+
2 rows in set (0.01 sec)

mysql> exit
Bye

This entry was posted in bugs, rants. Bookmark the permalink.

Leave a Reply