Bug #40660 crash/memory corruption when shutting down mysqld after invalid time_zone is set
Submitted: 12 Nov 2008 8:54 Modified: 2 Jul 2015 13:55
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.074-debug,5.1.30-debug, 6.0.8-debug OS:Windows
Assigned to: CPU Architecture:Any

[12 Nov 2008 8:54] Shane Bester
Description:
on a full debug build, there's invalid free done during shutdown after
an invalid time_zone was set:

ntdll.dll!RtlCheckForOrphanedCriticalSections()
ntdll.dll!RtlCheckForOrphanedCriticalSections()
mysqld-debug.exe!_sanity()[safemalloc.c:508]
mysqld-debug.exe!_myfree()[safemalloc.c:265]
mysqld-debug.exe!String::free()[sql_string.h:193]
mysqld-debug.exe!String::~String()[sql_string.h:88]
mysqld-debug.exe!$E2()
mysqld-debug.exe!doexit()[crt0dat.c:376]
mysqld-debug.exe!exit()[crt0dat.c:303]
mysqld-debug.exe!win_main()[mysqld.cc:4423]
mysqld-debug.exe!mysql_service()[mysqld.cc:4439]
mysqld-debug.exe!main()[mysqld.cc:4612]
mysqld-debug.exe!mainCRTStartup()[crt0.c:259]
kernel32.dll!BaseProcessInitPostImport()

How to repeat:
set global time_zone = substr('deadbeefdeadbeefdeadbeef',79);

mysqladmin shutdown -uroot
[12 Nov 2008 8:57] MySQL Verification Team
try running under valgrind if it don't crash:

valgrind --tool=memcheck   --leak-check=yes -v --show-reachable=yes  ./bin/mysqld-debug --basedir=./ --datadir=./data  --skip-grant-tables --skip-name-resolve

Windows debug versions all crashed..
[12 Nov 2008 15:16] MySQL Verification Team
Thank you for the bug report.

 	ntdll.dll!7c91b1fa() 	
>	mysqld.exe!malloc(unsigned int nSize=0x0012fa7c)  Line 139 + 0x15	C
 	mysqld.exe!DbugMalloc(unsigned int size=0x00000000)  Line 2016 + 0x9	C
 	mysqld.exe!_getptd()  Line 319	C
 	000007c4()	
 	ntdll.dll!7c901046() 	
 	mysqld.exe!_sanity(const char * filename=0x009840f0, unsigned int lineno=0x000000bd)  Line 481 + 0xd	C
 	mysqld.exe!_myfree(char * ptr=0x015b43e0, const char * filename=0x009840f0, unsigned int lineno=0x000000bd, int myflags=0x00000000)  Line 264 + 0xd	C
 	mysqld.exe!String::free()  Line 189 + 0x17	C++
 	mysqld.exe!String::~String()  Line 87 + 0x16	C++
 	mysqld.exe!$E2()  + 0xd	C++
 	mysqld.exe!doexit(int code=0x00000000, int quick=0x00000000, int retcaller=0x00000000)  Line 376	C
 	mysqld.exe!exit(int code=0x00000000)  Line 303 + 0xd	C
 	mysqld.exe!win_main(int argc=0x00000004, char * * argv=0x01093288)  Line 3897	C++
 	mysqld.exe!mysql_service(void * p=0x00000000)  Line 3913 + 0x12	C++
 	mysqld.exe!main(int argc=0x00000004, char * * argv=0x01093288)  Line 4088 + 0x7	C++
 	mysqld.exe!mainCRTStartup()  Line 259 + 0x19	C
 	kernel32.dll!7c817067()
[25 Nov 2008 17:06] Konstantin Osipov
This is a windows-only bug.
[2 Jul 2015 13:55] Praveenkumar Hulakund
Posted by developer:
 
This issue is fixed as part of patch for bug58165.
Issue is not reproducible on the latest versions of a code.