Bug #46676 mysqld got exception 0xc0000005
Submitted: 12 Aug 2009 13:45 Modified: 18 Jun 2010 14:31
Reporter: Douglas Wright Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S1 (Critical)
Version:5.1.37 OS:Microsoft Windows (Server 2003)
Assigned to: Paul Dubois CPU Architecture:Any
Triage: Triaged: D1 (Critical)

[12 Aug 2009 13:45] Douglas Wright
Description:
090812 14:31:00 - mysqld got exception 0xc0000005 ;
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=50331648
read_buffer_size=65536
max_used_connections=29
max_threads=500
threads_connected=19
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1365620 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x1d6964b0
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...
00000001401FBF29    mysqld.exe!get_schema_key_column_usage_record()[sql_show.cc:4739]
00000001401FAEAF    mysqld.exe!get_all_tables()[sql_show.cc:3396]
00000001401FDDBC    mysqld.exe!get_schema_tables_result()[sql_show.cc:6053]
00000001401E8E04    mysqld.exe!JOIN::exec()[sql_select.cc:1730]
00000001401EA50A    mysqld.exe!mysql_select()[sql_select.cc:2390]
00000001401EAA56    mysqld.exe!handle_select()[sql_select.cc:268]
00000001401A29A8    mysqld.exe!execute_sqlcom_select()[sql_parse.cc:5013]
00000001401A4197    mysqld.exe!mysql_execute_command()[sql_parse.cc:2207]
00000001401A99E6    mysqld.exe!mysql_parse()[sql_parse.cc:5936]
00000001401AA71A    mysqld.exe!dispatch_command()[sql_parse.cc:1215]
00000001401AB7E7    mysqld.exe!do_command()[sql_parse.cc:854]
000000014024E677    mysqld.exe!handle_one_connection()[sql_connect.cc:1127]
00000001402C0235    mysqld.exe!pthread_start()[my_winthread.c:85]
00000001403D4057    mysqld.exe!_callthreadstart()[thread.c:295]
00000001403D4125    mysqld.exe!_threadstart()[thread.c:275]
0000000077D6B71A    kernel32.dll!BaseThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 000000001D701700=SELECT COUNT(*) FROM `information_schema`.`KEY_COLUMN_USAGE`
thd->thread_id=2517
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

How to repeat:
1) Install MySQL 5.1.37
2) Load up PHPMyAdmin, and try to view the information_schema table.
3) Crash
[12 Aug 2009 14:20] Miguel Solorzano
See bug: http://bugs.mysql.com/bug.php?id=32099.
[12 Aug 2009 14:29] Douglas Wright
5.1.34 does not have this bug.
[12 Aug 2009 16:07] Miguel Solorzano
PHPMyADMIN

Attachment: phpmyadmin.png (image/png, text), 137.60 KiB.

[12 Aug 2009 16:09] Miguel Solorzano
I couldn't repeat this issue on Vista Premium Home Edition 64-bit.
[12 Aug 2009 20:15] Douglas Wright
It must be something to do with the specific database/table structure that I have as it's reproducible for me on 2 different machines (Server 2003 64-bit, and a 32-bit XP).

I will see if I can narrow it down.
[12 Aug 2009 20:38] Miguel Solorzano
I guess is specific to your database/table so if you are to able to find the cause would be nice you provide the dump file to create them, also your my.ini file. Thanks in advance.
[13 Aug 2009 4:45] Shane Bester
if you can upload just the schema for us, it might be enough:
mysqldump --all-databases --no-data --routines -uroot -p > bug46676_schema.sql

if not, then you have to narrow it down with your data.
[13 Aug 2009 22:15] Douglas Wright
Minimal schema

Attachment: bug46676_schema.sql (text/x-sql), 5.46 KiB.

[13 Aug 2009 22:18] Douglas Wright
I have uploaded the precise schema fragment that causes the crash.

I have also identified that this is a crash-bug specific to the InnoDB plugin (1.0.4). The version of InnoDB built in 5.1.37 does not crash.
[14 Aug 2009 3:16] Calvin Sun
Douglas - are you using the 1.0.4 plugin downloaded from InnoDB website, or the one built by yourself? Thanks!
[14 Aug 2009 8:05] Douglas Wright
The plugin was downloaded.
[14 Aug 2009 14:01] Mikhail Izioumtchenko
the stack backtrace doesn't seem to show anything InnoDB plugin related.
Would it reproduce with InnoDB builtin? Would it reproduce when mysqld
is started without InnoDB?
[14 Aug 2009 14:32] Douglas Wright
It's 100% reproducible with the plugin installed, and not reproducible at all without it.

So it's definitely plugin-related - whether the problem is on InnoDB's side, or MySQL's side is something that I can't help with.
[17 Aug 2009 6:30] Sveta Smirnova
Thank you for the report.

Verified as described.
[17 Aug 2009 6:31] Sveta Smirnova
Bug #46745 was marked as duplicate of this one.
[10 Nov 2009 16:03] Scott Noyes
Seems like it's related to circular foreign keys with the InnoDB plugin:

SET foreign_key_checks=0;
CREATE TABLE t1 (id int, foreign key (id) references t2(id));
CREATE TABLE t2 (id int, foreign key (id) references t1(id));
SET foreign_key_checks=1;
SELECT COUNT(*) FROM information_schema.key_column_usage;
-- now the server crashes
[11 Nov 2009 8:59] Calvin Sun
Scott, in which version, you reproduced the crash with the test case? I could not see a crash with 5.1.40. Thanks!
[12 Nov 2009 12:43] Calvin Sun
This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37. But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5). Add test case to catch future regression. Committed into internal repo as r6169.
[12 Nov 2009 14:17] Scott Noyes
Yes, my test was 5.1.37.
[21 Nov 2009 0:59] Hao Pang
Is there any other solution to avoid this bug? I also found this bug ,but for some reason I can't update the version to avoid it. So I want to know how to solve this bug in mysql 5.1.37 & InnoDB 1.0.4.
[30 Nov 2009 12: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/commits/92078

3226 Satya B	2009-11-30
      Applying InnoDB Plugin 1.0.6 snapshot, part 6. Add Testcase for BUG#46676
      
      1. add testcase for BUG#46676
      2. Allow CREATE INDEX to be interrupted
      3. ha_innobase::change_active_index(): When the history is
         missing, report it to the client, not to the error log
      4. ChangeLog entries
      
      appplied revisions:r6169, r6170, r6175, r6177, r6179
      
      Detailed revision comments:
      
      r6169 | calvin | 2009-11-12 14:40:43 +0200 (Thu, 12 Nov 2009) | 6 lines
      branches/zip: add test case for bug#46676
      
      This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
      But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
      Add test case to catch future regression.
      
      r6170 | marko | 2009-11-12 15:49:08 +0200 (Thu, 12 Nov 2009) | 4 lines
      branches/zip: Allow CREATE INDEX to be interrupted.  (Issue #354)
      
      rb://183 approved by Heikki Tuuri
      
      r6175 | vasil | 2009-11-16 20:07:39 +0200 (Mon, 16 Nov 2009) | 4 lines
      branches/zip:
      
      Wrap line at 78th char in the ChangeLog
      
      r6177 | calvin | 2009-11-16 20:20:38 +0200 (Mon, 16 Nov 2009) | 2 lines
      branches/zip: add an entry to ChangeLog for r6065
      
      r6179 | marko | 2009-11-17 10:19:34 +0200 (Tue, 17 Nov 2009) | 2 lines
      branches/zip: ha_innobase::change_active_index(): When the history is
      missing, report it to the client, not to the error log.
[1 Dec 2009 10:12] Satya B
patch queued to mysql-5.1-bugteam storage/innodb_plugin only.

Will be merged to mysql-trunk.
[2 Dec 2009 8:05] Bugs System
Pushed into 5.1.42 (revid:joro@sun.com-20091202080033-mndu4sxwx19lz2zs) (version source revid:satya.bn@sun.com-20091130122454-21essx3pnzsoe8xk) (merge vers: 5.1.42) (pib:13)
[16 Dec 2009 8:37] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091216083311-xorsasf5kopjxshf) (version source revid:alik@sun.com-20091214191830-wznm8245ku8xo702) (merge vers: 6.0.14-alpha) (pib:14)
[16 Dec 2009 8:44] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091216082430-s0gtzibcgkv4pqul) (version source revid:satya.bn@sun.com-20091202140050-nh3ebk6s3bziv8cb) (merge vers: 5.5.0-beta) (pib:14)
[16 Dec 2009 8:50] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20091216083231-rp8ecpnvkkbhtb27) (version source revid:alik@sun.com-20091212203859-fx4rx5uab47wwuzd) (merge vers: 5.6.0-beta) (pib:14)
[16 Dec 2009 16:32] Paul Dubois
How do I describe this bug for the changelog entry?
[23 Dec 2009 7:31] Satya B
Calvin,

Can you please help paul with documentation of this bug?
[23 Dec 2009 9:35] Calvin Sun
Paul, Satya,

The problem went away without making any changes. It is likely fixed by some other changes in the server. I do not know what's the real cause, but agreed to check in the test case. What's the best way to handle the case like this? The description of the problem:

Retrieving INFORMATION_SCHEMA.KEY_COLUMN_USAGE may crash the server on Windows when used with a dynamically loaded InnoDB plugin.
[5 Jan 2010 20:23] Paul Dubois
Test case change. No changelog entry needed.
[12 Mar 2010 14:19] Bugs System
Pushed into 5.1.44-ndb-7.0.14 (revid:jonas@mysql.com-20100312135944-t0z8s1da2orvl66x) (version source revid:jonas@mysql.com-20100312115609-woou0te4a6s4ae9y) (merge vers: 5.1.44-ndb-7.0.14) (pib:16)
[12 Mar 2010 14:34] Bugs System
Pushed into 5.1.44-ndb-6.2.19 (revid:jonas@mysql.com-20100312134846-tuqhd9w3tv4xgl3d) (version source revid:jonas@mysql.com-20100312060623-mx6407w2vx76h3by) (merge vers: 5.1.44-ndb-6.2.19) (pib:16)
[12 Mar 2010 14:50] Bugs System
Pushed into 5.1.44-ndb-6.3.33 (revid:jonas@mysql.com-20100312135724-xcw8vw2lu3mijrhn) (version source revid:jonas@mysql.com-20100312103652-snkltsd197l7q2yg) (merge vers: 5.1.44-ndb-6.3.33) (pib:16)
[12 Mar 2010 17:36] Paul Dubois
No changelog entry needed.
[5 May 2010 15:23] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[6 May 2010 17:44] Paul Dubois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[28 May 2010 6:14] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:42] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 7:09] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[30 May 2010 0:05] Paul Dubois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[15 Jun 2010 8:21] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100615080459-smuswd9ooeywcxuc) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (merge vers: 5.1.47) (pib:16)
[15 Jun 2010 8:38] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615080558-cw01bzdqr1bdmmec) (version source revid:mmakela@bk-internal.mysql.com-20100415070122-1nxji8ym4mao13ao) (pib:16)
[17 Jun 2010 12:20] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:08] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:48] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)