Bug #34298 Client programs generate assertion faults on Windows
Submitted: 4 Feb 2008 21:23 Modified: 11 Feb 2008 21:03
Reporter: Chuck Bell Email Updates:
Status: Closed
Category:Client Severity:S3 (Non-critical)
Version:6.0 OS:Microsoft Windows (Vista Business)
Assigned to: Magnus Blaudd Target Version:

[4 Feb 2008 21:23] Chuck Bell
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.
[7 Feb 2008 9:38] 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/41856

ChangeSet@1.2530, 2008-02-07 10:39:45+01:00, msvensson@pilot.mysql.com +1 -0
  Bug#34298 Client programs generate assertion faults on Windows
[7 Feb 2008 9:40] Magnus Blaudd
Approved by mail from Vlad and Chuck
[11 Feb 2008 16:26] Bugs System
Pushed into 6.0.5-alpha
[11 Feb 2008 21:03] Paul DuBois
Noted in 6.0.5 changelog.

On Windows, client programs generated assertion failures.