Bug #18553 mysqladmin flush-logs segfaults mysqld
Submitted: 27 Mar 2006 19:42 Modified: 27 Apr 2006 13:48
Reporter: [ name withheld ] Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.18 from backports.org OS:Linux (Debian GNU/Linux)
Assigned to: CPU Architecture:Any

[27 Mar 2006 19:42] [ name withheld ]
Description:
When the nightly cron runs I was receiving the following error:
/usr/bin/mysqladmin: refresh failed; error: 'Lost connection to MySQL server during query'

I narrowed it down to the command in the repeat section.  Every single time that command is run mysqld segfaults

Resolved stack trace:
0x818d544 handle_segfault + 660
0x4005b825 _end + 933395221
0x8439b9e reinit_io_cache + 62
0x8202307 _ZN9MYSQL_LOG12find_log_posEP11st_log_infoPKcb + 119
0x8202bc6 _ZN9MYSQL_LOG22purge_logs_before_dateEl + 86
0x8203daf _ZN9MYSQL_LOG16rotate_and_purgeEj + 207
0x81aac53 _Z20reload_acl_and_cacheP3THDmP13st_table_listPb + 771
0x81a00b4 _Z16dispatch_command19enum_server_commandP3THDPcj + 3060
0x819f46d _Z10do_commandP3THD + 141
0x819e932 handle_one_connection + 514
0x40055e51 _end + 933372225
0x402a092a _end + 935775258

I also tried doing this straight from a mysql prompt:
mysql> flush logs;
ERROR 2013 (HY000): Lost connection to MySQL server during query

How to repeat:
/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs
[28 Mar 2006 16:12] Valeriy Kravchuk
Thank you for a problem report. Please, send your debian.cnf content, describe your hardware, send uname -a results and glibc version.

Can you try to repeat with MySQL's static binaries of version 5.0.19 and inform about the results?
[28 Mar 2006 16:43] [ name withheld ]
debian.cnf:
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = XXXXXXXX
socket   = /var/run/mysqld/mysqld.sock

Linux penguana 2.4.29-vs1.2.10-2 #1 Tue Sep 13 22:54:11 CDT 2005 i686 GNU/Linux
ii  libc6          2.3.2.ds1-22   GNU C Library: Shared libraries and Timezone
ii  libc6-dev      2.3.2.ds1-22   GNU C Library: Development Libraries and Hea

Hardware
HP 2U rackmount, P3 1ghz, 1gb RAM, scsi hds

I will give static binaries a shot when I get the chance.
[30 Mar 2006 15:46] Valeriy Kravchuk
Thank you for the additional information. Please, when you'll have time, try to repeat with MySQL's static binaries of 5.0.19 and inform about the results.
[3 Apr 2006 9:01] Andreas Koenig
I have the same problem with Debian's mysql-server 5.0.19. I attached gdb to mysqld and fired the flush-logs command. The stack trace here:

(gdb) c
Continuing.
[New Thread -1246131280 (LWP 16328)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1246131280 (LWP 16328)]
0x0844ea89 in reinit_io_cache ()
(gdb) bt
#0  0x0844ea89 in reinit_io_cache ()
#1  0x082013eb in MYSQL_LOG::find_log_pos ()
#2  0x08203fbc in MYSQL_LOG::purge_logs_before_date ()
#3  0x08205157 in MYSQL_LOG::rotate_and_purge ()
#4  0x081a029a in reload_acl_and_cache ()
#5  0x081ab3c4 in dispatch_command ()
#6  0x081abfd8 in do_command ()
#7  0x081ac924 in handle_one_connection ()
#8  0xb7ea9ced in start_thread () from /lib/tls/libpthread.so.0
#9  0xb7ceadde in clone () from /lib/tls/libc.so.6

I'll try your static binary.
[3 Apr 2006 11:23] Andreas Koenig
I can reproduce the behaviour with your binary mysql-standard-5.0.19-linux-i686.tar.gz.

My Distro is Debian.

# uname -a
Linux k75 2.6.14 #1 Fri Jan 27 16:22:47 CET 2006 i686 GNU/Linux
# apt-show-versions|grep ^libc6
libc6-dev/testing uptodate 2.3.6-3
libc6/testing uptodate 2.3.6-3
# cat /proc/cpuinfo 
processor       : 0
vendor_id       : AuthenticAMD
cpu family      : 6
model           : 10
model name      : AMD Athlon(tm) XP
stepping        : 0
cpu MHz         : 1250.144
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 1
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr sse syscall mmxext 3dnowext 3dnow
bogomips        : 2503.42
# egrep -v '^#|^$' /etc/mysql/my.cnf
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0
[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/english
skip-external-locking
old_passwords   = 1
bind-address            = 127.0.0.1
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 128K
query_cache_limit       = 1048576
query_cache_size        = 16777216
query_cache_type        = 1
server-id               = 2
expire-logs-days        = 20
max_binlog_size         = 104857600
master-host=XXX.XXX.XXX.XXX
master-user=XXXXXXXX
master-password=XXXXXXXX
master-connect-retry=60
replicate-do-db=mod
relay-log=pause-relay-bin
skip-bdb
skip-innodb
[mysqldump]
quick
quote-names
max_allowed_packet      = 16M
[mysql]
[isamchk]
key_buffer              = 16M

(I've X'd out some master data)

I started mysql with the command

./bin/safe_mysqld --defaults-file=/etc/mysql/my.cnf --pid-file=/usr/local/mysql/data/k75.pid --skip-locking --language /usr/local/mysql/share/mysql/english --socket=/usr/local/mysql/data/mysqld.sock

and the flush-log command was this:

./bin/mysqladmin --socket=/usr/local/mysql/data/mysqld.sock flush-logs

The stack trace is less useful without symbols:

(gdb) c
Continuing.

Program received signal SIG32, Real-time event 32.
0x082ebc9f in ?? ()
(gdb) bt
#0  0x082ebc9f in ?? ()
#1  0x0000005f in ?? ()
#2  0xbf8ac1dc in ?? ()
#3  0x08587620 in ?? ()
#4  0x0863bf78 in ?? ()
#5  0x082dff0d in ?? ()
#6  0xbf8ac1dc in ?? ()
#7  0x00000020 in ?? ()
#8  0xbf8ac25c in ?? ()
#9  0x082dff20 in ?? ()
#10 0xbf8ac1dc in ?? ()
#11 0x00000000 in ?? ()

Hope this helps,
[15 Apr 2006 11:18] Christian Hammers
This seems to be a duplicate of bug 17733.
It has also been reported as Debian bug report at http://bugs.debian.org/360031

On my amd64 I cannot reproduce it.

bye,

-christian-
[22 Apr 2006 16:11] Valeriy Kravchuk
Duplicate of bug #17733.
[27 Apr 2006 7:38] Alessandro Polverini
I can confirm the problem is still present in debian version 5.0.20a-1
[27 Apr 2006 13:48] [ name withheld ]
I can confirm the problem still exists with Debian using 5.0.20.