Bug #27310 mysqld shutdown hangs
Submitted: 20 Mar 2007 22:26 Modified: 23 May 2007 9:02
Reporter: Gabriel Tataranu Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.37, 5.0.36 OS:Linux (Linux)
Assigned to:

[20 Mar 2007 22:26] Gabriel Tataranu
Description:
server (mysqld) doesn't shutdown cleanly. Version 5.0.27 doesn't have this problem on the same computer. Sometimes 5.0.37 does shutdown cleanly if a connection attempt has been made during shutdown, but not always.

How to repeat:
mysql-5.0.37 # /usr/local/mysql/share/mysql/mysql.server start
Starting MySQL SUCCESS! 

mysql-5.0.37 # /usr/local/mysql/share/mysql/mysql.server stop
Shutting down MySQL....................................................
.............................................................................

mysql-5.0.27 # /usr/local/mysql/share/mysql/mysql.server start
Starting MySQL SUCCESS! 
mysql-5.0.27 # /usr/local/mysql/share/mysql/mysql.server stop 
Shutting down MySQL... SUCCESS! 

From mysqlbug:
>Release:       mysql-5.0.37 (Source distribution)

>C compiler:    gcc (GCC) 4.1.1 (Gentoo 4.1.1-r3)
>C++ compiler:  g++ (GCC) 4.1.1 (Gentoo 4.1.1-r3)
>Environment:
        <machine, os, target, libraries (multiple lines)>
System: Linux dbi3 2.6.19-gentoo-r5 #4 SMP Fri Mar 16 08:57:13 EDT 2007 x86_64 AM
D Opteron(tm) Processor 246 GNU/Linux
Architecture: x86_64

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.1-r3/work/gcc-4.1.1/configure --prefix=
/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.1.1 --includedir=/usr/lib/gcc/x8
6_64-pc-linux-gnu/4.1.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu
/4.1.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.1.1/man --infodir=/usr/
share/gcc-data/x86_64-pc-linux-gnu/4.1.1/info --with-gxx-include-dir=/usr/lib/gcc
/x86_64-pc-linux-gnu/4.1.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_
64-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-
system-zlib --disable-checking --disable-werror --enable-secureplt --disable-libu
nwind-exceptions --enable-multilib --disable-libmudflap --disable-libssp --disabl
e-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable
-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1-r3)
Compilation info: CC='gcc'  CFLAGS=''  CXX='g++'  CXXFLAGS=''  LDFLAGS=''  ASFLAGS=''
LIBC: 
lrwxrwxrwx 1 root root 11 Mar 16 10:54 /lib/libc.so.6 -> libc-2.5.so
-rwxr-xr-x 1 root root 1238176 Mar 16 10:54 /lib/libc-2.5.so
-rw-r--r-- 1 root root 3923726 Mar 16 10:54 /usr/lib/libc.a
-rwxr-xr-x 1 root root 253 Mar 16 10:54 /usr/lib/libc.so
Configure command: ./configure '--prefix=/usr/local/mysql' '--enable-assembler' '
--enable-local-infile' '--disable-shared' '--with-mysqld-user=mysql' '--without-debug' '--without-docs' '--without-bench' '--with-extra-charsets=none' '--with-charset=latin1' '--with-mysqld-flags=all-static'

Suggested fix:
Downgrade to 5.0.27.
[21 Mar 2007 12:25] Valerii Kravchuk
Thank you for a problem report. Please, send/upload your MySQL server's error log, and send the results of:

uname -a
df -k
free
[21 Mar 2007 14:45] Gabriel Tataranu
as requested:

# uname -a
Linux dbi3 2.6.19-gentoo-r5 #4 SMP Fri Mar 16 08:57:13 EDT 2007 x86_64 AMD Opteron(tm) Processor 246 GNU/Linux

# df -k
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1              2118832   1991128    106180  95% /
udev                   4063152       112   4063040   1% /dev
/dev/sda3               988244     21384    956820   3% /var
/dev/sda6            129372448     22704 129349744   1% /mnt/backup
/dev/sda5              9765248     22760   9742488   1% /data/dbdata

Database (just created by mysql_installdb) is in /data/dbdata. The filesystem is xfs but it has been tested with ext2 as well.

# free
             total       used       free     shared    buffers     cached
Mem:       8126304     558516    7567788          0      23376     390636
-/+ buffers/cache:     144504    7981800
Swap:      1004052          0    1004052
[21 Mar 2007 15:03] Gabriel Tataranu
Forgot .err file. The last line at shutdown reads:

070321 11:00:55 [Note] /usr/local/mysql-test/libexec/mysqld: Normal shutdown

But the shutdown still goes on and never ends.
[22 Mar 2007 7:25] Valerii Kravchuk
Please, upload the entire error log. Send also the results of:

getconf GNU_LIBPTHREAD_VERSION
getconf GNU_LIBC_VERSION
[27 Mar 2007 15:23] Gabriel Tataranu
$ getconf GNU_LIBPTHREAD_VERSION
linuxthreads-0.10

$ getconf GNU_LIBC_VERSION
glibc 2.5

$ more /server.err 
070321 15:48:28  mysqld started
070321 15:48:28  InnoDB: Started; log sequence number 0 43655
070321 15:48:28 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.37'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
070321 15:48:58 [Note] /usr/local/mysql/libexec/mysqld: Normal shutdown
[28 Mar 2007 18:57] Sergei Golubchik
already pushed in 5.1-build
[20 Apr 2007 12:26] Wolfram Schlich
When will a fixed 5.0 version be released?
[20 Apr 2007 12:29] Sergei Golubchik
fixed in 5.0.42 and 5.1.18
[20 Apr 2007 12:33] Miguel Solorzano
Bug: http://bugs.mysql.com/bug.php?id=27977 was marked as duplicate
of this one.
[20 Apr 2007 12:36] Mads Martin Joergensen
Paul, make that 5.0.40
[20 Apr 2007 12:37] Sergei Golubchik
fixed in 5.0.40 actually
[20 Apr 2007 12:38] Wolfram Schlich
paul == sergei?! ;) *confused*
[20 Apr 2007 12:44] Wolfram Schlich
I fail to find any download links for versions >5.0.37 on
http://dev.mysql.com/downloads/mysql/5.0.html#source and
even ftp://ftp.mysql.com/pub/mysql/src/ has only 5.0.38... :(
[20 Apr 2007 12:50] Mads Martin Joergensen
5.0.40 wasn't released yet. Patience now :)
[24 Apr 2007 17:00] Paul Dubois
Noted in 5.0.40, 5.1.18 changelogs.

The server did not shut down cleanly.
[22 May 2007 3:43] Fred Tyler
I have the same problem. Seeing it in 5.0.41, so it's not fixed yet.

root@srv$ uname -a
Linux a0 2.6.15.7 #1 SMP Sat Jul 1 06:26:14 GMT 2006 i686 unknown unknown GNU/Linux

root@srv$ free
             total       used       free     shared    buffers     cached
Mem:        239536     222012      17524          0      47732     106336
-/+ buffers/cache:      67944     171592
Swap:       524280      59312     464968

root@srv$ getconf GNU_LIBPTHREAD_VERSION
linuxthreads-0.10

root@srv$ getconf GNU_LIBC_VERSION
glibc 2.3.5
[22 May 2007 12:30] Valerii Kravchuk
Bug is re-opened based on last comment and bug #28578 (that will be declared a duplicate). Looks like it has something to do with LinuxThreads as a default threading library.
[22 May 2007 19:21] Fred Tyler
Please ignore my report and close this bug. I accidentally compiled 5.0.37 in a directory labeled 5.0.41, and thus was testing against the wrong version.

This problem is indeed fixed in 5.0.41. I have tested it and mysqld shuts down fine now. Sorry for the trouble.
[23 May 2007 9:02] Valerii Kravchuk
Fixed in 5.0.41.