Bug #18225 temporary files rewriting problem during SHOW COLUMNS command
Submitted: 14 Mar 2006 15:20 Modified: 20 Mar 2006 12:38
Reporter: Frantisek Vacek Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.19/5.0.20BK/5.1.8BK OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[14 Mar 2006 15:20] Frantisek Vacek
Description:
I cann't issue command 'show columns from t' more than once. 

Bug was allready reported in Bug #9551 and it is reported as fixed, but it is not.

How to repeat:
Here is copy of mysql utility output:

mysql> show columns from t;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(11)          | NO   | PRI | NULL    | auto_increment |
| neco  | tinyint(1)       | YES  |     | NULL    |                |
| ineco | int(10) unsigned | YES  |     | NULL    |                |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> show columns from t;
ERROR 1 (HY000): Can't create/write to file '/System/Variable/tmp/#sql_17c5_0.MYI' (Errcode: 17)
mysql>
[14 Mar 2006 16:40] MySQL Verification Team
Thank you for the bug report. Since you are commented the bug:
http://bugs.mysql.com/bug.php?id=9551 as it wasn't fixed then I
tested starting the server with --exit-info=65535 and with the
current source server on 5.0/5.1 (not 4.1) I got a crash server
just issuing the commnand use db; or starting the mysql client
with mysql -uroot db. Starting the server without that option the
show columns not presented the issue reported.
Also I verified removing orphaned temporary files and with a
fresh table stuff using mysql_install_db:

(gdb) run --exit-info=65535
Starting program: /home/miguel/dbs/5.0/libexec/mysqld --exit-info=65535
[Thread debugging using libthread_db enabled]
[New Thread 1076976416 (LWP 6558)]
[New Thread 1090698160 (LWP 6561)]
[New Thread 1092799408 (LWP 6562)]
[New Thread 1094900656 (LWP 6563)]
[New Thread 1097001904 (LWP 6564)]
060314 13:17:23  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
060314 13:17:23  InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 0 43655.
InnoDB: Doing recovery: scanned up to log sequence number 0 43655
[New Thread 1099103152 (LWP 6565)]
[New Thread 1103879088 (LWP 6566)]
[New Thread 1105980336 (LWP 6567)]
[Thread 1099103152 (zombie) exited]
[New Thread 1108081584 (LWP 6568)]
060314 13:17:23  InnoDB: Started; log sequence number 0 43655
[New Thread 1099422640 (LWP 6569)]
[New Thread 1099623344 (LWP 6570)]
060314 13:17:23 [Note] /home/miguel/dbs/5.0/libexec/mysqld: ready for connections.
Version: '5.0.20-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1131862960 (LWP 6572)]
[Thread 1131862960 (zombie) exited]
[New Thread 1131862960 (LWP 6575)]
mysqld: my_bitmap.c:191: bitmap_clear_bit: Assertion `map->bitmap && bitmap_bit < map->bitmap_size*8' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 1131862960 (LWP 6575)]
0xffffe410 in __kernel_vsyscall ()
[15 Mar 2006 11:49] Frantisek Vacek
I'm sorry, I'm not sure if you can reproduce error without option --exit-info=65535.
Just to be sure, I'm not using this option and I still meet error, I was talking about.
[15 Mar 2006 14:30] MySQL Verification Team
Thank you for the feedback. In this case I wasn't able to repeat the
issue with current source server. The bug you had mentioned has
the same error message but is related to use that start option.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.20-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SHOW COLUMNS FROM t;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(11)          | NO   | PRI |         | auto_increment |
| neco  | tinyint(4)       | YES  |     |         |                |
| ineco | int(10) unsigned | YES  |     |         |                |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.01 sec)

mysql> SHOW COLUMNS FROM t;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(11)          | NO   | PRI |         | auto_increment |
| neco  | tinyint(4)       | YES  |     |         |                |
| ineco | int(10) unsigned | YES  |     |         |                |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> SHOW COLUMNS FROM t;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(11)          | NO   | PRI |         | auto_increment |
| neco  | tinyint(4)       | YES  |     |         |                |
| ineco | int(10) unsigned | YES  |     |         |                |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.01 sec)

mysql>
[15 Mar 2006 16:38] MySQL Verification Team
I changed the status of bug http://bugs.mysql.com/bug.php?id=9551
from closed to verified since the server crash. For this bug report with
current server I was unable to repeat.
[20 Mar 2006 10:52] Frantisek Vacek
Thanks for your effort, what I should check now? Both of us have same system, one is buggy, the second one is not. Why?

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.0.19

1. Maybe version 5.0.20 is bug free
2. You are using debug version, I probably the release one.
3. I've compiled server from sources.
4. There is some my.cnf magic difference on your and mine system.
5. ...

Fanda

----------------------------------------------------------
This is my my.cnf file:

# Example MySQL config file for small systems.
#
# This is for a system with little memory (<= 64M) where MySQL is only used
# from time to time and it's important that the mysqld daemon
# doesn't use much resources.
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /Files/MySQL) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients

[client]
#password       = your_password
port            = 3306
socket          = /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (using the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
server-id       = 1

# Uncomment the following if you want to log updates
#log-bin=mysql-bin

# Uncomment the following if you are NOT using BDB tables
#skip-bdb

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /Files/MySQL/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /Files/MySQL/
#innodb_log_arch_dir = /Files/MySQL/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 8M
sort_buffer_size = 8M

[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M

[mysqlhotcopy]
interactive-timeout
[20 Mar 2006 12:38] Frantisek Vacek
When I installed precompiled binary package mysql-standard-5.0.19-linux-i686.tar.gz, the bug not appears any more. It seems that problem will be somewhere in my version of glibc or in configuration or in other place. I have read linux source distribution notes and my glibc ver is 2.3.6, so I think that it could be high enough for mysqld.
[20 Mar 2007 0:03] Mike Tosh
I am encountering this also.  In order to recover, I have to remove the bugzilla database and delete the empty /tmp file. 

Versions:
OpenBSD webbox 3.9 GENERIC#617 i386
mysql  Ver 14.12 Distrib 5.0.22, for unknown-openbsd3.9 (i386) using readline 4.3

I encountered this while installing the bugzilla tables:
DBD::mysql::db selectrow_array failed: File './databasename/resolution.MYD' not found (Errcode: 9)

MySQL Statements:
show fields from bugs;
ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_51c7_0.MYD' (Errcode: 9)
show fields from bugs;
ERROR 1 (HY000): Can't create/write to file '/tmp/#sql_51c7_0.MYD' (Errcode: 17)

File permissions:
drwxrwxrwt   7 root    wheel  512 Mar 19 18:54 /tmp
-rw-rw----   1 _mysql  wheel    0 Mar 19 18:54 #sql_51c7_0.MYD

/etc/my.cnf:
[client]
port            = 3306
socket          = /var/run/mysql/mysql.sock
[mysqld]
port            = 3306
socket          = /var/run/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log-bin=mysql-bin
server-id       = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout