Bug #62426 MySQL crashes whenever a temporary tables created, tmpfs used for the mysql tmp
Submitted: 14 Sep 2011 0:57 Modified: 19 Nov 2011 9:30
Reporter: Michael Rikmas Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.5.15 OS:Linux (Centos 5.5)
Assigned to: CPU Architecture:Any
Tags: innodb, linux, tempfs, temporary table

[14 Sep 2011 0:57] Michael Rikmas
Description:
Mysql crashes when creating temporary table.
tmpfs used for temporary tables.

=== OS Configuration ===

     Release | CentOS release 5.5 (Final)
      Kernel | 2.6.18-194.el5
Architecture | CPU = 32-bit, OS = 32-bit
  Filesystem | ext3

=== Info ===
[root@centos55 mysql]# rpm -q libaio libaio-devel
libaio-0.3.106-5
libaio-devel-0.3.106-5

[root@centos55 mysql]# egrep "kioctx|kiocb" /proc/slabinfo
kioctx                23     40    192   20    1 : tunables  120   60    8 : slabdata      2      2      0
kiocb                  0      0    128   30    1 : tunables  120   60    8 : slabdata      0      0      0

[root@centos55 mysql]# cat /proc/sys/fs/aio-max-nr
65536

[root@centos55 mysql]# cat /proc/sys/fs/aio-nr
5732

=== Mysql info ===

@@tmpdir: /dev/shm/mysql
@@version: 5.5.15
@@innodb_flush_method: NULL
@@innodb_file_per_table: 1
@@innodb_use_native_aio: 1

How to repeat:
=== Install MySQL 5.5.15 ===
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-server-5.5.15-1.rhel5.i386.rpm/from/htt... http://dev.mysql.com/get/Downloads/MySQL-5.5/MySQL-client-5.5.15-1.rhel5.i386.rpm/from/htt... && sudo rpm -ihv MySQL-server-5.5.15-1.rhel5.i386.rpm && sudo rpm -ihv MySQL-client-5.5.15-1.rhel5.i386.rpm && /etc/init.d/mysql start && /usr/bin/mysql_secure_installation

=== Create ramdisk /dev/shm/mysql ===
# mkdir /dev/shm/mysql
# id mysql
uid=101(mysql) gid=103(mysql) groups=103(mysql)
# chown 101.103 /dev/shm/mysql/
# sudo vi /etc/fstab
add:
tmpfs                   /dev/shm/mysql          tmpfs   defaults        0 0
# sudo mount /dev/shm/mysql/

=== Configure mysql ===
# vi /etc/my.cnf
add:
  [mysqld]
  tmpdir = /dev/shm/mysql/
# /etc/init.d/mysql restart

=== Reproduce bug (create temporary table) ===

mysql> use mysql;
Database changed

mysql> create temporary table t1(c1 int);
Query OK, 0 rows affected (0.08 sec)

mysql> create temporary table t2(c1 int);
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    1
Current database: mysql

Query OK, 0 rows affected (0.05 sec)

[root@centos55 ~]# ls -lha /dev/shm/mysql/
total 0
drwxrwxrwt 2 root root 40 Sep 13 22:34 .
drwxrwxrwt 3 root root 60 Sep 13 20:52 ..

=====

mysql> create temporary table t1(c1 int);
ERROR 1046 (3D000): No database selected
mysql> use mysql;
Database changed
mysql> create temporary table t1(c1 int);
Query OK, 0 rows affected (0.08 sec)

mysql> create temporary table t2(c1 int);
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
ERROR: 
Can't connect to the server

mysql> create temporary table t2(c1 int);
No connection. Trying to reconnect...
Connection id:    1
Current database: mysql

Query OK, 0 rows affected (0.08 sec)
[14 Sep 2011 4:05] Valeriy Kravchuk
Please, send the error log content for the period of this test.
[14 Sep 2011 22:59] Michael Rikmas
error log: repeating bug

Attachment: bug-62426-error-log.txt (text/plain), 7.49 KiB.

[14 Sep 2011 22:59] Michael Rikmas
gdb: repeating bug

Attachment: bug-62426-gdb.txt (text/plain), 4.29 KiB.

[22 Sep 2011 3:23] Yasufumi Kinoshita
tmpfs, ramfs doesn't support both O_DIRECT and native_aio.
If you want to use .ibd on the fs, you should disable them.
Or you should not use InnoDB temporary tables...
[19 Oct 2011 9:30] Valeriy Kravchuk
Looks like a duplicate of bug #58421. Please, check.
[20 Nov 2011 7:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".