Description:
The client applications (mysqladmin, mysqltest) generate debug assertions on Windows machines. These assertions appear as popup windows when running the applications. While a mere annoyance, it prohibits running the test suite.
When you run the test suite on Windows Vista, the mysqladmin application generates 5-8 assertions. Clicking 'ignore' seems to get one past the problem. However, when the mysqltest application runs, it generates an endless supply of assertions where clicking 'ignore' does not satisfy the problem.
The assertion is:
Expression: (fh >= 0 && (unsigned)fh < (unsigned)_nhandle)
What this means is the test suite cannot run on Windows Vista.
Interestingly, the mysqltest program does not generate assertions when run on Windows XP.
Here are stack traces for mysqladmin and mysqltest:
mysqladmin.exe failure:
mysqladmin.exe!_close(int fh=400) Line 47 + 0x4a bytes C
> mysqladmin.exe!mysql_real_connect(st_mysql * mysql=0x0012fb5c, const char * host=0x005ae038, const char * user=0x01481d48, const char * passwd=0x0071af50, const char * db=0x00000000, unsigned int port=3306, const char * unix_socket=0x00000000, unsigned long client_flag=0) Line 2050 + 0xc bytes C
mysqladmin.exe!sql_connect(st_mysql * mysql=0x0012fb5c, unsigned int wait=0) Line 454 + 0x2e bytes C++
mysqladmin.exe!main(int argc=1, char * * argv=0x014840cc) Line 374 + 0x12 bytes C++
mysqladmin.exe!__tmainCRTStartup() Line 318 + 0x19 bytes C
mysqladmin.exe!mainCRTStartup() Line 187 C
kernel32.dll!75e23833()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!770ca9bd()
mysqltest.exe failure:
mysqltest.exe!_close(int fh=364) Line 47 + 0x4a bytes C
> mysqltest.exe!mysql_real_connect(st_mysql * mysql=0x007cd560, const char * host=0x005e3e80, const char * user=0x003e335d, const char * passwd=0x003e2d08, const char * db=0x003e3351, unsigned int port=9306, const char * unix_socket=0x00000000, unsigned long client_flag=2147549184) Line 2050 + 0xc bytes C
mysqltest.exe!safe_connect(st_mysql * mysql=0x007cd560, const char * name=0x003ef768, const char * host=0x00000000, const char * user=0x003e335d, const char * pass=0x003e2d08, const char * db=0x003e3351, int port=9306, const char * sock=0x003e32f9) Line 4021 + 0x26 bytes C
mysqltest.exe!main(int argc=20, char * * argv=0x003e3170) Line 6808 + 0x40 bytes C
mysqltest.exe!__tmainCRTStartup() Line 318 + 0x19 bytes C
mysqltest.exe!mainCRTStartup() Line 187 C
kernel32.dll!75e23833()
[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
ntdll.dll!770ca9bd()
Researching this problem shows that the code in client.c:2050 calls close for a socket that is not open and is beyond the range of handle values.
How to repeat:
clone mysql-6.0
build on Windows Vista (debug)
run ./mysql-test-run.pl and observe the mayhem ;)
Suggested fix:
Refactor the code in ./sql-common/client.c to not attempt to close the socket if it is not open.