Bug #58267 MySQL Client crashes when entering ^s^d^c (ctrl-s ctrl-d ctrl-c / c-s c-d c-c).
Submitted: 17 Nov 2010 18:48 Modified: 15 May 2013 16:41
Reporter: Michael Clark Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.5.30 OS:Linux
Assigned to: CPU Architecture:Any
Tags: client, crash, linux, windows?

[17 Nov 2010 18:48] Michael Clark
Description:
MySQL Client crashes when entering ^s^d^c (ctrl-s ctrl-d ctrl-c / c-s c-d c-c).

Screendump:
$ mysql -u *** -p*** -D ***
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 128
Server version: 5.0.51a-3ubuntu5.7 (Ubuntu)

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

mysql> ^CBye
*** glibc detected *** mysql: double free or corruption (!prev): 0x0812b090 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7312b25]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7316590]
/usr/lib/libmysqlclient.so.15(my_no_flags_free+0x21)[0xb75d2b01]
mysql[0x804fda1]
mysql[0x8050072]
/lib/tls/i686/cmov/libpthread.so.0[0xb7586e78]
/lib/tls/i686/cmov/libc.so.6[0xb730c2f5]
/lib/tls/i686/cmov/libc.so.6(_IO_do_write+0x1f)[0xb730c5ef]
/lib/tls/i686/cmov/libc.so.6(_IO_file_overflow+0xda)[0xb730ceba]
/lib/tls/i686/cmov/libc.so.6(__overflow+0x53)[0xb730f9b3]
/lib/tls/i686/cmov/libc.so.6(fputc+0xbb)[0xb7308deb]
mysql(_Z8tee_putsPKcP8_IO_FILE+0x2e)[0x804be8e]
mysql[0x804c004]
mysql[0x804fde6]
mysql(main+0x517)[0x8053217]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb72bd450]
mysql[0x804b9f1]
======= Memory map: ========
08048000-08059000 r-xp 00000000 fe:02 1900696                            /usr/bin/mysql
08059000-0805b000 rw-p 00011000 fe:02 1900696                            /usr/bin/mysql
0805b000-0805c000 rw-p 00000000 00:00 0
0812a000-0818f000 rw-p 00000000 00:00 0                                  [heap]
b7100000-b7121000 rw-p 00000000 00:00 0
b7121000-b7200000 ---p 00000000 00:00 0
b7296000-b729f000 r-xp 00000000 fe:02 3285005                            /lib/tls/i686/cmov/libnss_files-2.7.so
b729f000-b72a1000 rw-p 00008000 fe:02 3285005                            /lib/tls/i686/cmov/libnss_files-2.7.so
b72a1000-b72a3000 rw-p 00000000 00:00 0
b72a3000-b72a5000 r-xp 00000000 fe:02 3284999                            /lib/tls/i686/cmov/libdl-2.7.so
b72a5000-b72a7000 rw-p 00001000 fe:02 3284999                            /lib/tls/i686/cmov/libdl-2.7.so
b72a7000-b73f0000 r-xp 00000000 fe:02 3284996                            /lib/tls/i686/cmov/libc-2.7.so
b73f0000-b73f1000 r--p 00149000 fe:02 3284996                            /lib/tls/i686/cmov/libc-2.7.so
b73f1000-b73f3000 rw-p 0014a000 fe:02 3284996                            /lib/tls/i686/cmov/libc-2.7.so
b73f3000-b73f6000 rw-p 00000000 00:00 0
b73f6000-b7400000 r-xp 00000000 fe:02 1133011                            /lib/libgcc_s.so.1
b7400000-b7401000 rw-p 0000a000 fe:02 1133011                            /lib/libgcc_s.so.1
b7401000-b7424000 r-xp 00000000 fe:02 3285000                            /lib/tls/i686/cmov/libm-2.7.so
b7424000-b7426000 rw-p 00023000 fe:02 3285000                            /lib/tls/i686/cmov/libm-2.7.so
b7426000-b7427000 rw-p 00000000 00:00 0
b7427000-b750f000 r-xp 00000000 fe:02 1092124                            /usr/lib/libstdc++.so.6.0.9
b750f000-b7512000 r--p 000e8000 fe:02 1092124                            /usr/lib/libstdc++.so.6.0.9
b7512000-b7514000 rw-p 000eb000 fe:02 1092124                            /usr/lib/libstdc++.so.6.0.9
b7514000-b751a000 rw-p 00000000 00:00 0
b751a000-b752e000 r-xp 00000000 fe:02 1092193                            /usr/lib/libz.so.1.2.3.3
b752e000-b752f000 rw-p 00013000 fe:02 1092193                            /usr/lib/libz.so.1.2.3.3
b752f000-b7543000 r-xp 00000000 fe:02 3285002                            /lib/tls/i686/cmov/libnsl-2.7.so
b7543000-b7545000 rw-p 00013000 fe:02 3285002                            /lib/tls/i686/cmov/libnsl-2.7.so
b7545000-b7547000 rw-p 00000000 00:00 0
b7547000-b7550000 r-xp 00000000 fe:02 3284998                            /lib/tls/i686/cmov/libcrypt-2.7.so
b7550000-b7552000 rw-p 00008000 fe:02 3284998                            /lib/tls/i686/cmov/libcrypt-2.7.so
b7552000-b7579000 rw-p 00000000 00:00 0
b7579000-b758d000 r-xp 00000000 fe:02 3285010                            /lib/tls/i686/cmov/libpthread-2.7.so
b758d000-b758f000 rw-p 00013000 fe:02 3285010                            /lib/tls/i686/cmov/libpthread-2.7.so
b758f000-b7591000 rw-p 00000000 00:00 0
b7591000-b772d000 r-xp 00000000 fe:02 1090557                            /usr/lib/libmysqlclient.so.15.0.0
b772d000-b7770000 rw-p 0019b000 fe:02 1090557                            /usr/lib/libmysqlclient.so.15.0.0
b7770000-b7772000 rw-p 00000000 00:00 0
b7772000-b779f000 r-xp 00000000 fe:02 1133010                            /lib/libncurses.so.5.6
b779f000-b77a2000 rw-p 0002c000 fe:02 1133010                            /lib/libncurses.so.5.6
b77a2000-b77ce000 r-xp 00000000 fe:02 1132995                            /lib/libreadline.so.5.2
b77ce000-b77d2000 rw-p 0002c000 fe:02 1132995                            /lib/libreadline.so.5.2
b77d2000-b77d3000 rw-p 00000000 00:00 0
b77d9000-b77dc000 rw-p 00000000 00:00 0
b77dc000-b77f6000 r-xp 00000000 fe:02 1130497                            /lib/ld-2.7.so
b77f6000-b77f8000 rw-p 00019000 fe:02 1130497                            /lib/ld-2.7.so
bfcd3000-bfce8000 rw-p 00000000 00:00 0                                  [stack]
Bye
Aborted

How to repeat:
Open MySQL client and type ^s^d^c (ctrl-s ctrl-d ctrl-c / c-s c-d c-c).
[17 Nov 2010 20:51] Peter Laursen
Also on Windows it crashes!
[18 Nov 2010 15:24] Valeriy Kravchuk
Please, check if this happens with a newer version of client, from MySQL 5.0.91.
[18 Nov 2010 15:47] Peter Laursen
@Valeriy: I tried 5.1.52.  Wouldn't it be pretty simple to check for yourself? It is 6 keystrokes only!
[18 Nov 2010 17:20] Michael Clark
Worked on 5.1.51 on ArchLinux.
$mysql --version
mysql  Ver 14.14 Distrib 5.1.51, for unknown-linux-gnu (x86_64) using readline 6.1

For consistency, on Ubuntu LTS:
$mysql --version
mysql  Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (i486) using readline 5.2
[18 Nov 2010 17:40] Valeriy Kravchuk
Peter,

Do you really think that I had NOT checked? I've check with 5.1.52 on Windows XP (no crash), 5.1.54 on Ubuntu 10.04 and 5.1.54 on Mac OS X. No crash or any problem on these platforms for me. That's why I ask.

If you prefer me to just ignore bug reports that I can not repeat, I can surely do so.
[18 Nov 2010 18:19] Peter Laursen
I tried again with client shipped with Win7/64 5.0.90 + 5.1.52 + 5.5.7 servers. They all crash for me.
[18 Nov 2010 18:43] Peter Laursen
Actually I think 'crash' is not the right term.  I noticed the string 'Bye' shortly before the client window crashes (using the client icon from Windows startmenu). When explicitly starting 'mysql' from cmd.exe the client window does not close: 

C:\Users\Peter>cd \program files\mysql\mysql server 5.1\bin

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql -uroot -p
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.52-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

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

mysql> Bye
Ctrl-C -- exit!

C:\Program Files\MySQL\MySQL Server 5.1\bin>

.. so this is maybe rather a graceful exit as expected (on CTRL+C). But if console window used by client also closes it 'looks like' a crash.
[18 Nov 2010 18:47] Michael Clark
No crash for me on WinXP with 5.1.52. One difference is that I am using SSH for Linux testing. Possibly a 64 bit only issue, since both linux boxes are x86_64 (one is a VPS which may cause more oddity - the ArchLinux box is a dedicated PC), and the other person who seems to be able to reproduce is on Win7/64.

Console log (no crash):
C:\Documents and Settings\michaelc>mysql --version
mysql  Ver 14.14 Distrib 5.1.52, for Win32 (ia32)

C:\Documents and Settings\michaelc>mysql -u root -p
Enter password: **************
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.52-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

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

mysql> Ctrl-C -- exit!
Bye
[18 Nov 2010 18:56] Sveta Smirnova
Thank you for the feedback.

Please try with current version 5.1.52: as nobody could repeat this can be fixed already.

If problem still exists please send accurate name of the package you use (file name you downloaded from http://dev.mysql.com/downloads) and output of echo $MALLOC_CHECK_
[19 Dec 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[11 Jan 2011 5:02] Michael Clark
Package url:
http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.1/mysql-5.1.54.tar.gz

echo $MALLOC_CHECK_:
$ echo $MALLOC_CHECK_

$ 

Version:
$ mysql --version
mysql  Ver 14.14 Distrib 5.1.54, for unknown-linux-gnu (x86_64) using readline 6.1

PKGBUILD (parameters to ./configure, etc):
http://projects.archlinux.org/svntogit/packages.git/tree/mysql/repos/extra-x86_64/PKGBUILD

The most recent time I noticed my xterm display the message "Output has been suspended by pressing Ctrl-S. Press Ctrl-Q to resume. Relevantly, pressing ctrl-q removes the problem. My sense is that output being suspended is the problem; possibly a bug in readline instead of mysql. I was able to replicate it with 9to my knowledge) the most recent stable version of MySQL.
[11 Jan 2011 5:02] Michael Clark
Package url:
http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.1/mysql-5.1.54.tar.gz

echo $MALLOC_CHECK_:
$ echo $MALLOC_CHECK_

$ 

Version:
$ mysql --version
mysql  Ver 14.14 Distrib 5.1.54, for unknown-linux-gnu (x86_64) using readline 6.1

PKGBUILD (parameters to ./configure, etc):
http://projects.archlinux.org/svntogit/packages.git/tree/mysql/repos/extra-x86_64/PKGBUILD

The most recent time I noticed my xterm display the message "Output has been suspended by pressing Ctrl-S. Press Ctrl-Q to resume. Relevantly, pressing ctrl-q removes the problem. My sense is that output being suspended is the problem; possibly a bug in readline instead of mysql. I was able to replicate it with MySQL 5.1.54, therefore it is not fixed.
[8 Jul 2011 18:09] Sveta Smirnova
Thank you for the feedback.

You wrote you use 5.1 client, but provided options for 5.5 build. Which actual build options do you use?
[8 Aug 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[9 Sep 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[1 Apr 2013 21:43] Michael Clark
Sveta Smirnova, as I am downloading a binary executable, I am not personally using any build options. As Arch Linux has switched to MariaDB for future MySQL upgrades, it will possibly become more difficult to use MySQL for you. How would you like me to find what build options MySQL was compiled with?
[1 Apr 2013 21:54] Michael Clark
Was able to reproduce in Arch Linux (not updated to MariaDB yet) with version 5.5.30. Since this is the current version used in the buildfile I linked earlier, this should give you correct buildflags.

Output of mysql --version:
mysql  Ver 14.14 Distrib 5.5.30, for Linux (x86_64) using readline 5.1

Was not able to reproduce on current dev vm with MySQL 5.1.56 in Gentoo.
Output of mysql --version:
mysql  Ver 14.14 Distrib 5.1.56, for pc-linux-gnu (x86_64) using readline 5.1
[15 Apr 2013 16:41] Sveta Smirnova
Michael,

thank you for the update.

Earlier you wrote:

> Package url:
> http://ftp.gwdg.de/pub/misc/mysql/Downloads/MySQL-5.1/mysql-5.1.54.tar.gz

This is source package, not binary one

> PKGBUILD (parameters to ./configure, etc):
> http://projects.archlinux.org/svntogit/packages.git/tree/mysql/repos/extra-x86_64/PKGBUILD

These are options, used to build version 5.5. Please specify which options you use to build version 5.1.54 or which binary package do you download now.
[16 May 2013 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".