Bug #17485 Instance Manager: mysql client crashes when connecting to the IM
Submitted: 16 Feb 2006 16:54 Modified: 30 Aug 2006 20:23
Reporter: Lenz Grimmer Email Updates:
Status: Closed Impact on me:
Category:Instance Manager Severity:S2 (Serious)
Version:5.0.24-BK, 5.0.18 OS:Linux (SUSE Linux 10.0)
Assigned to: Jim Winstead CPU Architecture:Any

[16 Feb 2006 16:54] Lenz Grimmer
I installed MySQL 5.1.6 using the glibc-23 x86 RPMs from dev.mysql.com.

I configured it to use the IM for maintaining my instance by editing /etc/init.d/mysql and setting "use_mysqld_safe" to "0" and I created a minimal configuration file:


I created an "admin" user and stored the user name and password in the default password file location /etc/mysqlmanager.passwd using "mysqlmanager -P > /etc/mysqlmanager.passwd"

Starting up the server using "/etc/init.d/mysql start" uses the IM and the socket file /var/lib/mysql/manager.sock is created. I can connect to the MySQL server just fine.

I then tried to connect to the IM using the MySQL command line client, which causes the client to crash after asking for the password:

  $ mysql --socket=/var/lib/mysql/manager.sock -u admin -p
  Enter password:
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 25 to server version: 0.2-alpha

  Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

  zsh: 25796 segmentation fault  mysql --socket=/var/lib/mysql/manager.sock -u admin -p

Looking at a gdb backtrace of the crash reveals:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1075996352 (LWP 26102)]
0x4016bdc3 in strlen () from /lib/tls/libc.so.6
(gdb) bt
#0  0x4016bdc3 in strlen () from /lib/tls/libc.so.6
#1  0x0805fbb4 in String::append (this=0x0, s=0x0) at sql_string.cc:467
#2  0x0805e43c in construct_prompt () at mysql.cc:3601
#3  0x08058fbc in read_and_execute (interactive=true) at sql_string.h:86
#4  0x0805815b in main (argc=6, argv=0x81b3208) at mysql.cc:471

Connecting with the MySQL Query Browser worked, however - I was able to exchange commands with the IM just fine! It's just the commandline client that fails.

Further investigation revealed that my ~/.my.cnf is the culprit - removing it also made the segfault to go away. Putting it back in place causes the crash - here is what it contains:

  prompt = '\U:\d >\ '

So something in the routine that constructs the prompt is confused by what the IM sends, it seems...

How to repeat:
See the instructions above
[20 Feb 2006 11:18] Konstantin Osipov
Brian, Lenz,
the instance manager speaks plain 3.23 protocol. The bug should be assigned to however broke 5.1 in respect to 3.23 client-server protocol.
[20 Feb 2006 11:18] Konstantin Osipov
[23 Feb 2006 0:17] Brian Aker
Which means there is a problem in all installs with someone connecting to old servers.
[1 Mar 2006 23:35] Brian Aker
Please verify if this works in 5.0.
[6 Mar 2006 8:58] Lenz Grimmer
The same happens in MySQL 5.0.18
[6 Mar 2006 9:01] Lenz Grimmer
To summarize: the mysql client does only crash, if I modify the commandline prompt. It's either the prompt handling in the mysql client in general, or the IM not sending everything that the client expects to actually fill in all values required for the modified prompt settings.
[3 Jun 2006 13:02] Valeriy Kravchuk

Please, try to repeat with the latest versions released, 5.1.9 and 5.0.20. Is it still not fixed?
[26 Jun 2006 14:30] Lenz Grimmer
Yes, I can still reproduce this with MySQL 5.0.22 :(
[3 Jul 2006 12:27] Valeriy Kravchuk
Verified with mysql/mysqlmanager from 5.0.24-BK. Command:

prompt '\U:\d >\ '

crashes mysql command line client when it is conected to IM.
[11 Jul 2006 2:52] Jim Winstead
this happens because the \U prompt string sends "SELECT USER()" to get the username info. i'll make it fall back to what was specified on the command line when that fails.
[11 Jul 2006 19:36] 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:

[17 Jul 2006 20:04] Jim Winstead
Pushed to mysql-5.0-kt.
[18 Aug 2006 14:51] Reggie Burnett
pushed into 5.0.25 and 5.1.12
[30 Aug 2006 20:23] Paul Dubois
Noted in 5.0.25, 5.1.12 changelogs.

Use of the --prompt option or prompt command caused mysql to be
unable to connect to the Instance Manager.