Bug #5672 Shift+Enter segfaults Client
Submitted: 20 Sep 2004 19:03 Modified: 22 Feb 2005 13:39
Reporter: Christoffer Landtman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:mysql-4.1.4-gamma-standard OS:Linux (Debian Linux (unstable))
Assigned to: Jim Winstead CPU Architecture:Any

[20 Sep 2004 19:03] Christoffer Landtman
Description:
When opening a connection with the "mysql"-command line client, either accidentally or intentionally pressing Enter while Shift is pressed will segfault the client.

winnie:/usr/local/mysql/data# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14 to server version: 4.1.4-gamma-standard

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

mysql> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql> Segmentation fault
winnie:/usr/local/mysql/data# cd
winnie:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 4.1.4-gamma-standard

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

mysql> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

mysql> Segmentation fault
winnie:~#

Using the precompiled, binary version of MySQL 4.1.4-gamma. The original issue was spotted using MySQL-4.1.1-alpha, but I wanted to test it with the latest version before reporting.

How to repeat:
Initialize connection to server using mysql-commandline client, and press Enter while having Shift pressed.
[24 Sep 2004 9:32] Hartmut Holzgraefe
Can't reproduce this with self compiled 4.1.4 binaries on Linux,
haven't checked our precompiled binaries though
[7 Oct 2004 22:37] Matthew Lord
Hi,

Thank you for your bug report!

I'm having trouble repeating this with 4.1.5-gamma on a linux box.  Could provide specific about 
the machine you're having problems on?  I have many linux boxes to test on and I can find the 
most similar one to use.

I was testing mysql-standard-4.1.5-gamma-pc-linux-i686 with this machine:
Linux quadxeon.mysql.com 2.6.7 #4 SMP Tue Jun 29 22:48:44 CEST 2004 i686 i686 i386 GNU/
Linux

Best Regards
[11 Oct 2004 15:58] Christoffer Landtman
I just noticed myself that if I switch to console mode, the symptoms dissapear. However, when using e.g. "konsole" (within KDE) the crash still occurs. Would there be any good tools to dump what Shift+Enter produces so that I could supply You with this?

Here is some more info on my system

Linux winnie 2.6.6 #11 Tue May 18 21:05:41 EEST 2004 i686 GNU/Linux

KDE is version 3.3.0-1
[11 Oct 2004 17:10] Matthew Lord
Hi,

You could use strace and attach it to the client process.  This way you can see what is
actually getting sent to the server from your keystrokes.

Best Regards
[11 Oct 2004 20:38] Christoffer Landtman
These are the last lines of the strace log:

...
write(1, "mysql> ", 7)                  = 7
read(0, "\33", 1)                       = 1
read(0, "O", 1)                         = 1
read(0, "M", 1)                         = 1
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
 
I hope that this might shed some more light on what actually is going on. Please let me know if You need more information from either strace or the system

Regards
[13 Nov 2004 13:45] Christoffer Landtman
I wanted to inform You that I just installed mysql 4.1.7 and this behaviour is still present.
[13 Nov 2004 18:31] Hakan Küçükyılmaz
Can repeat on SuSE 9.1 Linux with self compiled 4.1.8 (4.1.8-debug-log).

After a 'SELECT 1;' and several Shift+Enter my box starts heavy swaping. After swap is full mysqlclient terminates. I run it with gdb, the output looks like this:

[17:44] root@(none)>
Program received signal SIGTERM, Terminated.
0x0805aaf5 in _rl_dispatch (key=256, map=0x100) at readline.c:529
529       return _rl_dispatch_subseq (key, map, 0);
Current language:  auto; currently c
(gdb) bt
#0  0x0805aaf5 in _rl_dispatch (key=256, map=0x100) at readline.c:529
#1  0x0805acc8 in _rl_dispatch_subseq (key=256, map=0x80a4580, got_subseq=0)
    at readline.c:626
#2  0x0805aafa in _rl_dispatch (key=256, map=0x100) at readline.c:529
#3  0x0805acc8 in _rl_dispatch_subseq (key=256, map=0x80a4580, got_subseq=0)
    at readline.c:626
#4  0x0805aafa in _rl_dispatch (key=256, map=0x100) at readline.c:529
#5  0x0805acc8 in _rl_dispatch_subseq (key=256, map=0x80a4580, got_subseq=0)
    at readline.c:626
#6  0x0805aafa in _rl_dispatch (key=256, map=0x100) at readline.c:529
#7  0x0805acc8 in _rl_dispatch_subseq (key=256, map=0x80a4580, got_subseq=0)
    at readline.c:626
#8  0x0805aafa in _rl_dispatch (key=256, map=0x100) at readline.c:529
#9  0x0805acc8 in _rl_dispatch_subseq (key=256, map=0x80a4580, got_subseq=0)
...
this lines repeats at least to #5000. After #5000 the box started heavy swaping again. The swapping didn't stop for a hour, so I killed gdb.
[22 Nov 2004 18:44] Matthew Lord
Hakan was able to repeat this by doing:

select 1;
shift+enter
shift+enter
shift+enter
shift+enter
select 1;
shift+enter
shift+enter
shift+enter
shift+enter
select 1;
shift+enter
shift+enter
shift+enter
shift+enter
select 1;
shift+enter
shift+enter
shift+enter
shift+enter
select 1;
shift+enter
shift+enter
shift+enter
shift+enter
select 1;
shift+enter
shift+enter
shift+enter
shift+enter
[22 Nov 2004 19:19] Matthew Lord
Hakan was able to repeat this another time by doing:

select 1; shift enter; ctrl enter; altgr enter; alt enter; ctrl enter and a final shift enter ---> heavy 
swapping
[1 Feb 2005 3:49] Jim Winstead
This is a bug in our bundled version of readline. I've backported a fix from the latest version of GNU readline, and we'll look at upgrading fully to the latest version for MySQL 5.0 or 5.1.
[18 Feb 2005 0:00] Jim Winstead
Pushed, will be in 4.1.11.
[22 Feb 2005 13:39] Paul DuBois
Noted in 4.1.11 changelog.