Bug #25765 too many dbg heap assertions on windows
Submitted: 22 Jan 2007 22:33 Modified: 10 Apr 2007 19:04
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S6 (Debug Builds)
Version:5.1.14 OS:Microsoft Windows (w2k3)
Assigned to: Iggy Galarza CPU Architecture:Any
Tags: bfsm_2007_03_01

[22 Jan 2007 22:33] Shane Bester
Description:
Running mysqld-debug.exe crashes too easily with debug assertions which are happening often.  Visual Popups include messages like this:

"
Debug Assertion Failed!
File: dbgheap.c
Line: 1132

Expression: _CrtIsValidHeapPointer(pUserData)
"

and
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

and
DAMAGE: before (null) block(#112) at 0x01f67688

(Press Retry to debug the application)

[Abort] [Retry] [Ignore]

How to repeat:
Start the server like this:
mysqld-debug --console --skip-grant-tables --skip-name-resolve

Then login and run this:

create table t1(id int)engine=myisam;
alter table t1 engine=innodb;

On another occasion, simply running SHOW TABLE STATUS with a bunch of tables
caused the same types of assertions.

Suggested fix:
make sure the mysql test suite runs and passes on mysqld-debug.exe
[22 Jan 2007 23:21] Miguel Solorzano
Thank you for the bug report. Verified as described.

Call stack:

>	mysqld-debug.exe!_free_dbg_lk(void * pUserData=0x0202ad60, int nBlockUse=1)  Line 1143 + 0x30	C
 	mysqld-debug.exe!_free_dbg(void * pUserData=0x0202ad60, int nBlockUse=1)  Line 1081 + 0xd	C
 	mysqld-debug.exe!free(void * pUserData=0x0202ad60)  Line 1036 + 0xb	C
 	mysqld-debug.exe!my_no_flags_free(char * ptr=0x0202ad60)  Line 59 + 0x9	C
 	mysqld-debug.exe!ha_innobase::close()  Line 2475 + 0xf	C++
 	mysqld-debug.exe!closefrm(st_table * table=0x0202a478, int free_share=1)  Line 1623 + 0x13	C++
 	mysqld-debug.exe!intern_close_table(st_table * table=0x0202a478)  Line 758 + 0xb	C++
 	mysqld-debug.exe!mysql_alter_table(THD * thd=0x02014870, char * new_db=0x02023f58, char * new_name=0x02023d60, st_ha_create_information * lex_create_info=0x02014f00, st_table_list * table_list=0x02023d88, List<create_field> & fields={...}, List<Key> & keys={...}, unsigned int order_num=0, st_order * order=0x00000000, int ignore=0, st_alter_info * alter_info=0x020150d8, int do_send_ok=1)  Line 6433 + 0x9	C++
 	mysqld-debug.exe!mysql_execute_command(THD * thd=0x02014870)  Line 3213 + 0x64	C++
 	mysqld-debug.exe!mysql_parse(THD * thd=0x02014870, char * inBuf=0x02023d08, unsigned int length=28)  Line 6162 + 0x9	C++
 	mysqld-debug.exe!dispatch_command(enum_server_command command=COM_QUERY, THD * thd=0x02014870, char * packet=0x0201bc59, unsigned int packet_length=29)  Line 1857 + 0x1d	C++
 	mysqld-debug.exe!do_command(THD * thd=0x02014870)  Line 1626 + 0x31	C++
 	mysqld-debug.exe!handle_one_connection(void * arg=0x02014870)  Line 1232 + 0x9	C++
 	mysqld-debug.exe!pthread_start(void * param=0x020166b8)  Line 62 + 0x9	C
 	mysqld-debug.exe!_threadstart(void * ptd=0x020160d0)  Line 196 + 0xd	C
 	kernel32.dll!7c80b683()
[20 Mar 2007 14:07] 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/22349

ChangeSet@1.2402, 2007-03-20 10:07:23-04:00, iggy@recycle.(none) +1 -0
  Bug#25765 too many dbg heap assertions on windows
  - SAFEMALLOC should be defined for each project in debug Windows builds.
  SAFEMALLOC was not defined for the innodb project. Debug asserts caused 
  due to mixed SAFEMALLOC defines.
[22 Mar 2007 20:05] Mads Martin Joergensen
Fixed in 5.1.17
[4 Apr 2007 3:31] Paul Dubois
Noted in 5.1.17 changelog.

On Windows, debug builds of mysqld could fail with heap assertions.

Setting report to Patch Queued pending fix for 5.0.x.
[10 Apr 2007 16:01] Timothy Smith
This was also pushed into 5.0.40 on 22 Mar, but was not properly marked at that time.  Our apologies.
[10 Apr 2007 19:04] Paul Dubois
Noted in 5.0.40 changelog.