Bug #58460 Innodb plugin release built crash debug server built
Submitted: 24 Nov 2010 14:21
Reporter: Miguel Solorzano Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S2 (Serious)
Version:5.1 OS:Microsoft Windows (Vista X86_64)
Assigned to: Assigned Account CPU Architecture:Any
Triage: Triaged: D2 (Serious)

[24 Nov 2010 14:21] Miguel Solorzano
Description:
Noticed when handling bug: http://bugs.mysql.com/bug.php?id=58449.

Loading the ha_innodb_plugin.dll release built with the debug server crash it: 

C:\DBS>c:\dbs\5.1\bin\mysqld --console --standalone --port=3306 --ignore-builtin-innodb --plugin-load=innodb=ha_innodb_plugin.dll;innodb_trx=ha_innodb_plugin.dll;innodb_locks=ha_innodb_plugin.dll;innodb_lock_waits=ha_innodb_plugin.dll;innodb_cmp
=ha_innodb_plugin.dll
101124 12:07:19 [Note] Plugin 'FEDERATED' is disabled.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks use InnoDB's own implementation
InnoDB: Compressed tables use zlib 1.2.3
101124 12:07:19  InnoDB: highest supported file format is Barracuda.
101124 12:07:19 InnoDB Plugin 1.0.13 started; log sequence number 57287
101124 12:07:19 [Note] Event Scheduler: Loaded 0 events
101124 12:07:19 [Note] c:\dbs\5.1\bin\mysqld: ready for connections.
Version: '5.1.54-Win X64-debug'  socket: ''  port: 3306  Source distribution
f:\dd\vctools\crt_bld\self_64_amd64\crt\src\dbgheap.c(1317) : Assertion failed: _CrtIsValidHeapPointer(pUserData)
HEAP CORRUPTION DETECTED: before Normal block (#50) at 0x000000000212EF48.
CRT detected that the application wrote to memory before start of heap buffer.
HEAP CORRUPTION DETECTED: after Normal block (#50) at 0x000000000212EF48.
CRT detected that the application wrote to memory after end of heap buffer.
101124 12:07:37 - 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=8384512
read_buffer_size=131072
max_used_connections=1
max_threads=151
threads_connected=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338138 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x20b4db8
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...
000000013FE952B2    mysqld.exe!_free_dbg_nolock()[dbgheap.c:1405]
000000013FE94D36    mysqld.exe!_free_dbg()[dbgheap.c:1258]
000000013FEB59E8    mysqld.exe!free()[dbgfree.c:50]
000000014056E6BD    mysqld.exe!my_no_flags_free()[my_malloc.c:70]
000007FEEFDED7A5    ha_innodb_plugin.dll!???
00000001400B2E4D    mysqld.exe!closefrm()[table.cc:1997]
000000013FFEF97E    mysqld.exe!intern_close_table()[sql_base.cc:783]
0000000140055ECE    mysqld.exe!mysql_alter_table()[sql_table.cc:7418]
0000000140091319    mysqld.exe!mysql_execute_command()[sql_parse.cc:2969]
000000014009C1B0    mysqld.exe!mysql_parse()[sql_parse.cc:6072]
000000014008CC12    mysqld.exe!dispatch_command()[sql_parse.cc:1263]
000000014008BEB4    mysqld.exe!do_command()[sql_parse.cc:889]
000000013FF531F8    mysqld.exe!handle_one_connection()[sql_connect.cc:1136]
0000000140481228    mysqld.exe!pthread_start()[my_winthread.c:85]
00000001404596C5    mysqld.exe!_callthreadstart()[thread.c:295]
0000000140459697    mysqld.exe!_threadstart()[thread.c:277]
000000007754BE3D    kernel32.dll!BaseThreadInitThunk()
0000000077756A51    ntdll.dll!RtlUserThreadStart()
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 00000000021271C8=ALTER TABLE  `B` ADD FOREIGN KEY (  `a_id` ) REFERENCES  `debug`.`A` (`a_id`)
ON DELETE CASCADE ON UPDATE CASCADE
thd->thread_id=1
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.

C:\DBS>

How to repeat:
CREATE TABLE  `debug`.`A` (
`a_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`a_content` VARCHAR( 100 ) NOT NULL
) ENGINE = INNODB;

# Create table B
CREATE TABLE  `debug`.`B` (
`b_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`a_id` INT NOT NULL ,
`b_content` VARCHAR( 100 ) NOT NULL ,
INDEX (  `a_id` )
) ENGINE = INNODB;

# Add FK to B
ALTER TABLE  `B` ADD FOREIGN KEY (  `a_id` ) REFERENCES  `debug`.`A` (`a_id`)
ON DELETE CASCADE ON UPDATE CASCADE;

Suggested fix:
-
[24 Nov 2010 14:24] Miguel Solorzano
See: http://bugs.mysql.com/bug.php?id=49022.
[27 Jan 2011 14:50] Luis Soares
See also: BUG#59647 .
[24 Feb 2012 19:13] Sinisa Milivojevic
Luis,

Can you tell me the connection between this bug and #59647 ????