MySQL Client (using Percona Server) segmentation fault bug


I just wanted to take not of this, so if there are bugs that I might be facing for the next time with the same result, then this post can be helpful.

I have this OS info:

OS: CentOS release 6.4 (Final)
Kernel: 2.6.32-358.11.1.el6.x86_64
PS version: Percona-Server-5.6.12-rc60.4

Using this tarball which is the source, Percona-Server-5.6.12-rc60.4.tar.gz from http://www.percona.com/downloads/Percona-Server-5.6/Percona-Server-5.6.12-rc60.4/source/ and the build and installation went well.


However, when I try to run mysql client with,

# mysql -u root
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.12 Source distribution

Copyright (c) 2009-2013 Percona Ireland Ltd.
Copyright (c) 2000, 2013, 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.

Segmentation fault
Trying to use gdb,
# gdb mysql
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/mysql/bin/mysql...done.
(gdb) run -uroot
Starting program: /usr/local/mysql/bin/mysql -uroot
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff6839700 (LWP 24788)]
[Thread 0x7ffff6839700 (LWP 24788) exited]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.12 Source distribution

Copyright (c) 2009-2013 Percona Ireland Ltd.
Copyright (c) 2000, 2013, 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.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004c18f3 in terminal_alloc (el=0xa0fa00, t=<value optimized out>, cap=0xffffffffffffd750 <Address 0xffffffffffffd750 out of bounds>)
    at /home/toytoy/mysqlsandbox/Percona-Server-5.6.12-rc60.4/cmd-line-utils/libedit/terminal.c:334
334 if (cap == NULL || *cap == '\0') {
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.107.el6.x86_64 libgcc-4.4.7-3.el6.x86_64 libstdc++-4.4.7-3.el6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64
(gdb) quit

A debugging session is active.
 Inferior 1 [process 24785] will be killed.



However, I manage to arrive and give it a fix it as somehow relevant to what other bugs I have found with MySQL server (specifically, http://bugs.mysql.com/bug.php?id=45562).
In file, Percona-Server-5.6.12-rc60.4/cmd-line-utils/libedit/terminal.c, it seems that function private void terminal_alloc(EditLine *el, const struct termcapstr *t, const char *cap)is called 3 times in the file with either NULL or '\0' value and a string (char *).

So commenting char buf[TC_BUFSIZE]; at line 877, and changing

area = NULL;

in line 887 works great. Still having the same approach on the bug link

Running make and make install afterwards makes it running after running gdb. See below,

# gdb mysql
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/mysql/bin/mysql...done.
(gdb) run -uroot
Starting program: /usr/local/mysql/bin/mysql -uroot
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff6839700 (LWP 18001)]
[Thread 0x7ffff6839700 (LWP 18001) exited]
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.12 Source distribution
Copyright (c) 2009-2013 Percona Ireland Ltd.
Copyright (c) 2000, 2013, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.14 sec)


mysql> quit
Bye


Hope this helps!

Comments

Popular posts from this blog

Converting sectors into MB - Useful in understanding the sectors in iostat in Linux

What is Disk Contention?

Installing MySQL from source: Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)