Bug #68939 mysqld crashes by signal 5
Submitted: 12 Apr 2013 8:06 Modified: 12 Apr 2013 14:45
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.6.10 OS:Linux (CentOS 6.3)
Assigned to: CPU Architecture:Any
Tags: alter_table_manage_keys, foreign_key

[12 Apr 2013 8:06] Tsubasa Tanaka
Description:
mysqld crashes with these operation.

1) Open MySQL Workbench and choose "Edit Table Data" for 4 tables and edit some rows.
2) Connect mysql command line client and some updates and deletes.
3) And run "ALTER TABLE parent_table DROP PRIMARY KEY" from mysql client.

I expected it returns
 "MySQL error code 150: Foreign key constraint is incorrectly formed".

But mysqld crashes and doesn't error-log any entry without crash recovery.
I can't repeat it even using same data but I have a core file.

How to repeat:
I can't repeat it.

Error log.

130412 16:17:27 mysqld_safe Number of processes running now: 0
130412 16:17:27 mysqld_safe mysqld restarted
2013-04-12 16:17:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timest
amp server option (see documentation for more details).
2013-04-12 16:17:27 17211 [Note] Plugin 'FEDERATED' is disabled.
2013-04-12 16:17:27 17211 [Note] InnoDB: The InnoDB memory heap is disabled
2013-04-12 16:17:27 17211 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2013-04-12 16:17:27 17211 [Note] InnoDB: Compressed tables use zlib 1.2.3
2013-04-12 16:17:27 17211 [Note] InnoDB: CPU does not support crc32 instructions
2013-04-12 16:17:27 17211 [Note] InnoDB: Initializing buffer pool, size = 1.0G
2013-04-12 16:17:27 17211 [Note] InnoDB: Completed initialization of buffer pool
2013-04-12 16:17:27 17211 [Note] InnoDB: Highest supported file format is Barracuda.
2013-04-12 16:17:27 17211 [Note] InnoDB: Log scan progressed past the checkpoint lsn 5330865
2013-04-12 16:17:27 17211 [Note] InnoDB: Database was not shutdown normally!
2013-04-12 16:17:27 17211 [Note] InnoDB: Starting crash recovery.
2013-04-12 16:17:27 17211 [Note] InnoDB: Reading tablespace information from the .ibd files...
2013-04-12 16:17:27 17211 [Note] InnoDB: Restoring possible half-written data pages
2013-04-12 16:17:27 17211 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 5335719
2013-04-12 16:17:27 17211 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
InnoDB: Last MySQL binlog file position 0 26324, file name bin.000006
2013-04-12 16:17:27 17211 [Warning] Invalid (old?) table or database name '#sql-3b15_b31'
2013-04-12 16:17:27 17211 [Note] InnoDB: 128 rollback segment(s) are active.
2013-04-12 16:17:27 17211 [Note] InnoDB: Waiting for purge to start
2013-04-12 16:17:27 17211 [Note] InnoDB: 1.2.10 started; log sequence number 5335719
2013-04-12 16:17:27 17211 [Note] Recovering after a crash using bin
2013-04-12 16:17:27 17211 [Note] Starting crash recovery...
2013-04-12 16:17:27 17211 [Note] Crash recovery finished.
2013-04-12 16:17:27 17211 [Note] Server hostname (bind-address): '*'; port: 64056
2013-04-12 16:17:27 17211 [Note] IPv6 is not available.
2013-04-12 16:17:27 17211 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
2013-04-12 16:17:27 17211 [Note] Server socket created on IP: '0.0.0.0'.
2013-04-12 16:17:27 17211 [Warning] Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
2013-04-12 16:17:27 17211 [Note] Event Scheduler: Loaded 0 events
2013-04-12 16:17:27 17211 [Note] /usr/mysql/5.6.10/bin/mysqld: ready for connections.
Version: '5.6.10-log'  socket: '/usr/mysql/5.6.10/data/mysql.sock'  port: 64056  Source distribution

Backtrace.

Program terminated with signal 5, Trace/breakpoint trap.
#0  0x0000000000712a91 in alter_table_manage_keys (table=0x7fee94011760, indexes_were_disabled=0,
    keys_onoff=Alter_info::LEAVE_AS_IS) at /home/ttanaka/mysql-5.6.10/sql/sql_table.cc:6145
6145        if (!indexes_were_disabled)
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64 libgcc-4.4.7-3.el6.x86_64 libstdc++-4.4.7-3.el6.x86_64 nss-softokn-freebl-3.12.9-11.el6.x86_64
(gdb) bt
#0  0x0000000000712a91 in alter_table_manage_keys (table=0x7fee94011760, indexes_were_disabled=0,
    keys_onoff=Alter_info::LEAVE_AS_IS) at /home/ttanaka/mysql-5.6.10/sql/sql_table.cc:6145
#1  0x000000000071f8c2 in copy_data_between_tables (thd=<value optimized out>, new_db=0x7fef00000000 "",
    new_name=<value optimized out>, create_info=<value optimized out>, table_list=0x7fee94004e90,
    alter_info=<value optimized out>, ord
[12 Apr 2013 8:13] Tsubasa Tanaka
Uploaded to ftp server.

core-68939.gz
schema-68939.sql(table definitions without data)
[12 Apr 2013 9:35] MySQL Verification Team
I think your schema-68939.sql is wrong file. Can you upload the full schema again, output of:  mysqladmin -uroot --no-data --all-databases > schema2-68939.sql ?

Also, please start server with --thread-stack=5M and let me know if that prevents a crash?
[12 Apr 2013 9:42] MySQL Verification Team
Also upload your mysqld file (compressed and named 68939-mysqld.gz (for example) and output of "rpm -qa|grep -i glibc" so we can examine the corefile
[12 Apr 2013 9:58] Tsubasa Tanaka
I uploaded full schema including datas schema2-68939.sql.gz and mysqld-68939.gz.

And it doesn't crash with --thread-stack=5M and "ALTER TABLE", it returns errno 150 correctly.

mysql56> show tables;
+----------------+
| Tables_in_test |
+----------------+
| addresses      |
| conditions     |
| hosts          |
| scripts        |
+----------------+
4 rows in set (0.00 sec)

mysql56> SHOW GLOBAL VARIABLES LIKE 'thread_stack';
+---------------+---------+
| Variable_name | Value   |
+---------------+---------+
| thread_stack  | 5242880 |
+---------------+---------+
1 row in set (0.00 sec)

mysql56> ALTER TABLE scripts DROP PRIMARY KEY;
ERROR 1025 (HY000): Error on rename of './logs/#sql-4690_5' to './logs/scripts' (errno: 150 - Foreign key constraint is incorrectly formed)

Thanks.
[12 Apr 2013 10:41] MySQL Verification Team
Hi! There is no crash in the corefile.  There is a breakpoint, see int3 :

(gdb) disassemble  alter_table_manage_keys
Dump of assembler code for function alter_table_manage_keys(TABLE*, int, Alter_info::enum_enable_or_disable):
   0x0000000000712a70 <+0>:     push   %rbp
   0x0000000000712a71 <+1>:     cmp    $0x1,%edx
   0x0000000000712a74 <+4>:     mov    %rsp,%rbp
   0x0000000000712a77 <+7>:     push   %r12
   0x0000000000712a79 <+9>:     push   %rbx
   0x0000000000712a7a <+10>:    mov    %rdi,%rbx
   0x0000000000712a7d <+13>:    je     0x712ac8 <alter_table_manage_keys(TABLE*, int, Alter_info::enum_enable_or_disable)+88>
   0x0000000000712a7f <+15>:    cmp    $0x2,%edx
   0x0000000000712a82 <+18>:    je     0x712a94 <alter_table_manage_keys(TABLE*, int, Alter_info::enum_enable_or_disable)+36>
   0x0000000000712a84 <+20>:    test   %edx,%edx
   0x0000000000712a86 <+22>:    je     0x712a90 <alter_table_manage_keys(TABLE*, int, Alter_info::enum_enable_or_disable)+32>
   0x0000000000712a88 <+24>:    xor    %eax,%eax
   0x0000000000712a8a <+26>:    pop    %rbx
   0x0000000000712a8b <+27>:    pop    %r12
   0x0000000000712a8d <+29>:    leaveq
   0x0000000000712a8e <+30>:    retq
   0x0000000000712a8f <+31>:    nop
   0x0000000000712a90 <+32>:    int3
=> 0x0000000000712a91 <+33>:    divb   0x48(%rsp,%rsi,8)
   0x0000000000712a95 <+37>:    mov    0x8(%rbx),%edi
   0x0000000000712a98 <+40>:    mov    $0x2,%esi

Please check your source code, and your builds... Or try our official builds?
[12 Apr 2013 14:43] Tsubasa Tanaka
Hi,

> There is a breakpoint,

Maybe I mistaked when I used gdb some days ago.
I'm sorry for taking your time.
Would you like to mark "Not a Bug" this case?

> Or try our official builds?

Yes, we take them in production environment,
I'm testing in not-production environment in this time.

Regards,
tsubasa