Bug #60858 mysql.exe crashes under XP SP2 when called with its full path
Submitted: 13 Apr 2011 20:58 Modified: 31 May 2012 17:40
Reporter: Peter Brawley (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.6.5 OS:Windows (32-bit XP, 64-bit XP)
Assigned to: CPU Architecture:Any
Tags: qc, regression

[13 Apr 2011 20:58] Peter Brawley
Description:
In WinXP SP2, when called as ...

C:\Program Files\MySQL\MySQL Server 5.6\bin\mysql

or as ...

"C:\Program Files\MySQL\MySQL Server 5.6"\bin\mysql

mysql.exe crashes with ...

mysql.exe has encountered a problem and needs to close.  We are sorry for the inconvenience.

How to repeat:
As above

Suggested fix:
Must call it as:

cd C:\Program Files\MySQL\MySQL Server 5.6\bin
mysql
[13 Apr 2011 21:00] Peter Brawley
No other MySQL program exhibits this behaviour.
[14 Apr 2011 0:16] MySQL Verification Team
I couldn't repeat on Vista 64-bit:

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\DBS>"c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
[14 Apr 2011 0:58] Peter Brawley
Error properties show these propertes

Fault bucket -1897348216.

or

Faulting application mysql.exe, version 5.6.2.0, faulting module mysql.exe, version 5.6.2.0, fault address 0x0000f8b3.

or

Faulting application mysql.exe, version 5.6.2.0, faulting module mysql.exe, version 5.6.2.0, fault address 0x0000dcc4.

Nothing else crashing. Doesn't matter what else is running.
[14 Apr 2011 6:49] Valeriy Kravchuk
I can not repeat this on 32-bit Windows XP:

C:\Program Files\MySQL\MySQL Server 5.5\bin>net start mysql56
The MySQL56 service is starting.
The MySQL56 service was started successfully.

C:\Program Files\MySQL\MySQL Server 5.5\bin>"c:\Program Files\MySQL\MySQL Server
 5.6\bin\mysql" -uroot -proot -P3314 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Is there anything wrong in my test? Can you try to re-install 5.6.2 again after downloading it from some other mirror?
[14 Apr 2011 8:04] Peter Brawley
The second .msi file is byte-for-byte identical with the first. A repair installation with it made no difference.
[16 Apr 2011 7:41] Santo Leto
I couldn't repeat the crash on Windows 7 64-bit (using the archive):

C:\Users\sleto>d:\Santo_Local\mysql-official-releases\mysql-5.6.2-m5-winx64\mysql-5.6.2-m5-winx64\bin\mysql
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
[17 Apr 2011 15:47] MySQL Verification Team
I can repeat it like this:
I:\>"I:\mysql\5.6\5.6.2\mysql-5.6.2-m5-win32\"bin\mysql.exe --no-defaults

Crash is here:

mysql.exe!handle_options  Line 202	
mysql.exe!get_options Line 1837 	
mysql.exe!main Line 1164 
mysql.exe!__tmainCRTStartup()  Line 266

Line 202 refers to:

if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */

cur_arg is 0x00 so we have null ptr deref.
[17 Apr 2011 16:05] MySQL Verification Team
I didn't fully debug it, but the only relevant difference between 5.5 (no crash) and 5.6 is the code implemented for:
WL 5331 Support Unicode for Windows command line client
[18 Apr 2011 6:15] Valeriy Kravchuk
Verified on 32-bit XP as described by Shane. This command:

C:\Program Files\MySQL\MySQL Server 5.5\bin>"c:\Program Files\MySQL\MySQL Server
 5.6"\bin\mysql

crashes. Stack trace VS2005 shows me is:

>	mysql.exe!my_load_defaults(const char * conf_file=0x004d1aa4, const char * * groups=0x004f5a40, int * argc=0x0012ff80, char * * * argv=0x0012ff20, const char * * * default_directories=0x00837258)  Line 532 + 0x24 bytes	
 	mysql.exe!load_defaults(const char * conf_file=0x004d1aa4, const char * * groups=0x004f5a40, int * argc=0x0012ff80, char * * * argv=0x0012ff20)  Line 469 + 0x1e bytes	
 	mysql.exe!main(int argc=2, char * * argv=0x00de3118)  Line 1158 + 0x19 bytes	
 	mysql.exe!__tmainCRTStartup()  Line 266 + 0x12 bytes
[20 Apr 2011 6:14] MySQL Verification Team
related: bug #60901
[19 Apr 2012 10:04] Valeriy Kravchuk
I can not repeat it today with 5.6.5 on the same 64-bit Windows XP where it crashed before:

Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.

C:\Documents and Settings\Administrator>"c:\Program Files\MySQL\MySQL Server 5.6
\bin\mysql" --no-defaults
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

C:\Documents and Settings\Administrator>"c:\Program Files\MySQL\MySQL Server 5.6
\bin\mysql" --version
c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql  Ver 14.14 Distrib 5.6.5-m8, f
or Win64 (x86)

C:\Documents and Settings\Administrator>cd "c:\Program Files\MySQL\MySQL Server
5.6\bin"

C:\Program Files\MySQL\MySQL Server 5.6\bin>"c:\Program Files\MySQL\MySQL Server
 5.6\bin\mysql" --no-defaults
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

C:\Program Files\MySQL\MySQL Server 5.6\bin>cd c:\tmp

C:\tmp>"c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql" --no-defaults
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

C:\tmp>"c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" --no-defaults
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N
O)

C:\tmp>"c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe" --version
c:\Program Files\MySQL\MySQL Server 5.6\bin\mysql.exe  Ver 14.14 Distrib 5.6.5-m
8, for Win64 (x86)
[19 Apr 2012 10:37] MySQL Verification Team
Still crashes 5.6.5 32-bit client.  I ran it like this:
H:\>"H:\ade\mysql\5.6\5.6.5\mysql-5.6.5-m8-win32\"bin\mysql.exe --no-defaults

mysql.exe!handle_options  Line 203
mysql.exe!get_options Line 1925
mysql.exe!main Line 1237
mysql.exe!__tmainCRTStartup Line 266

handle_options is crashing on this line:
if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */

For some reason --no-defaults is not ignoring my c:\my.ini file, since that is still being read.  In that file I got this:

[client]
shared-memory-base-name=MYSQL
socket=i:/ade/mysql.sock

[mysql]
no-beep
[19 Apr 2012 10:54] Valeriy Kravchuk
Indeed, still crashes here when called as:

C:\Program Files\MySQL\MySQL Server 5.5\bin>"c:\Program Files\MySQL\MySQL Server
 5.6\"bin\mysql.exe --version
[31 May 2012 17:40] Paul DuBois
Noted in 5.6.6 changelog.

On Windows, the mysql client crashed when invoked using its full path
name.