Bug #11028 Crash on create table like
Submitted: 2 Jun 2005 6:45 Modified: 2 Aug 2005 5:24
Reporter: Peter Zaitsev (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.12 OS:Linux (Linux x86)
Assigned to: Antony Curtis CPU Architecture:Any

[2 Jun 2005 6:45] Peter Zaitsev
Description:
MySQL crashed (several times in similar circumstances)   running create table like statement:

mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=67108864
read_buffer_size=126976
max_used_connections=22
max_connections=100
threads_connected=23
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 180335 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x877c1e0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xbfc9ca38, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x808df77
0x82e8af8
0x8308413
0x808a8fe
0x810ea96
0x809f279
0x80a2c9f
0x809d0f2
0x809cab4
0x809c167
0x82e62ac
0x830fc3a
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8785a50 = create table cache.cache0033_new like cache_base
thd->thread_id=23
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.

Resolved stack trace:

0x808df77 handle_segfault + 423
0x82e8af8 pthread_sighandler + 184
0x8308413 stpcpy + 19
0x808a8fe lock_and_wait_for_table_name__FP3THDP13st_table_list + 78
0x810ea96 mysql_create_like_table__FP3THDP13st_table_listP24st_ha_create_informationP11Table_ident + 214
0x809f279 mysql_execute_command__FP3THD + 4665
0x80a2c9f mysql_parse__FP3THDPcUi + 207
0x809d0f2 dispatch_command__F19enum_server_commandP3THDPcUi + 1586
0x809cab4 do_command__FP3THD + 196
0x809c167 handle_one_connection + 615
0x82e62ac pthread_start_thread + 220
0x830fc3a thread_start + 4

Table structure:

CREATE TABLE `cache_base` (
  `type` varchar(255) default NULL,
  `tag` blob NOT NULL,
  `tag_crc` int(11) NOT NULL default '0',
  `data` mediumblob NOT NULL,
  `expires` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  KEY `tag_crc` (`tag_crc`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8

How to repeat:
The fully repeatable case does not exist. 
I just can tell the problem does not happen if statement is executed on its own but when intensive concurrent access is happening.

Full series of statement which script runs for different tables:

   rename table cache_0001 to cache_0001_tmp;
   create table cache_0001_new like cache_base;
   insert into cache_0001_new select * from cache0001_tmp where expires>now();
   drop table cache_0001_tmp;
   rename table cache_0001_new to cache_0001;
[2 Jun 2005 23:30] Peter Zaitsev
OK. I finally found very simple test case which leads to 100% crash:

shrek:/var/lib/mysql # mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.12-standard-log

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

mysql> create table test.y like x;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>

The main thing is there should be no active database for this crash to happen.
[2 Jun 2005 23:41] MySQL Verification Team
miguel@hegel:~/dbs/4.1$ bin/mysql -uroot     
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.13-debug

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

mysql> create table test.y like x;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[5 Jun 2005 17:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25617
[9 Jun 2005 15:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25821
[9 Jun 2005 18:48] Antony Curtis
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

pushed to 4.1.13 repo,
merged to 5.0.8
[2 Aug 2005 5:24] Jon Stephens
Fix documented in 4.1.13 and 5.0.8 changelogs.