Bug #28791 mysql static builds mysqld goes into a suspended state without mysqlmanager
Submitted: 30 May 2007 22:57 Modified: 6 Jul 2007 4:55
Reporter: Dathan Pattishall Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.34-5.0.41 OS:Linux (2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28 EST 2006 x86_64 x86_64 x86_64 GNU/Linux)
Assigned to: CPU Architecture:Any
Tags: IPC, MYSQL SERVER, mysqlmanager, process controll, safe_mysqld, static builds

[30 May 2007 22:57] Dathan Pattishall
Description:
Building the mysql server (mysqld) all static i.e.

--enable-shared \
                --with-mysqld-ldflags='-all-static' \
                --with-client-ldflags='-all-static' \
                $USE_OTHER_LIBC_DIR \

Causes mysqld to not run from a standalone process, it will only execute properly with mysqlmanager.

Here is the reason below

open("/var/lib/mysql/ibdata1", O_RDWR)  = 8
fcntl(8, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
open("/var/lib/mysql/ib_logfile0", O_RDWR) = 13
fcntl(13, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
open("/var/lib/mysql/ib_logfile1", O_RDWR) = 14
fcntl(14, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0
mmap(NULL, 2101248, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d4e9c4000
mmap(NULL, 1359986688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d4ebc5000
pread(13, "\0\0\0\0\0\7GX\0\0\0\25d\352\r@$\357M@\1\0\0\0\377\377"..., 512, 512) = 512
pread(13, "\0\0\0\0\0\7GY\0\0\0\25d\352\r@$\357M@\1\0\0\0\377\377"..., 512, 1536) = 512
pread(13, "\0\0\0\0\0\7GY\0\0\0\25d\352\r@$\357M@\1\0\0\0\377\377"..., 512, 1536) = 512
pread(13, "\0\0\0\0\0\0\0\25?\372\320\0\0\0\0\0    \0\0\0\0\0\0\0"..., 2048, 0) = 2048
pread(8, "\341W\7n\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\25d\352\r@\0\0\0"..., 16384, 81920) = 16384
mmap(NULL, 2117632, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x2d9fcc1000
pread(8, "\341W\7n\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\25d\352\r@\0\0\0"..., 1048576, 1048576) = 1048576
pread(8, "\r@\215W\0\0\3q\0\0\3m\377\377\377\377\0\0\0\25d\314\216"..., 1048576, 2097152) = 1048576
pread(14, "\212\262u\7\1@\0/\0\7GSnfo\1\0\0\0\0\0\0\0\0vern.fs@"..., 65536, 82791424) = 65536
pread(14, "\212\262u\7\1@\0/\0\7GSnfo\1\0\0\0\0\0\0\0\0vern.fs@"..., 512, 82791424) = 512
time(NULL)                              = 1179341853
kill(28977, SIGRTMIN)                   = -1 EPERM (Operation not permitted)
sched_yield()                           = 0
time(NULL)                              = 1179341853
rt_sigprocmask(SIG_SETMASK, NULL, [HUP INT QUIT PIPE TERM TSTP RTMIN], 8) = 0
rt_sigsuspend([HUP INT QUIT PIPE TERM TSTP]

Since mysql manager evokes the mysqld process via a IPC pipe, the server continues to execute, while invoking mysqld on the command line or via safe_mysqld will hang the process.

Here is a debug trace that shows post innodb setup

T@16384: | | | >_mymalloc
T@16384: | | | | enter: Size: 24
T@16384: | | | | exit: ptr: 0x1d1cc5c8
T@16384: | | | <_mymalloc
T@16384: | | | exit: fd: 8
T@16384: | | <create_temp_file
T@16384: | | >my_close
T@16384: | | | my: fd: 8  MyFlags: 16
T@16384: | | | >_myfree
T@16384: | | | | enter: ptr: 0x1d1cc5c8
T@16384: | | | <_myfree
T@16384: | | <my_close

Here are the compile options

export CC=/usr/bin/gcc
export CXX=/usr/bin/gcc
export MYSQL_RPMBUILD_TEST="no"
export LD_LIBARY_PATH=$LD_LIBARY_PATH:/lib64:/usr/lib64
export CFLAGS="-O3 -static -fomit-frame-pointer -ffixed-ebp -m64"
export CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"

rpmbuild -ba --define '_with_static 1' mysql-5.0.41.spec

I like static builds, I don't like giving up 5% of resources to a dynamic load :)

How to repeat:
Build mysqld into a static build with these options

BuildMySQL "\
                --enable-shared \
                --with-mysqld-ldflags='-all-static' \
                --with-client-ldflags='-all-static' \
                $USE_OTHER_LIBC_DIR \
                --with-extra-charsets=complex \
                --with-comment=\"MySQL Community Edition (Flickr)\" \
                --with-server-suffix='%{server_suffix}' \
                --with-archive-storage-engine \
                --with-innodb \
                --with-ndbcluster \
                --with-csv-storage-engine \
                --with-example-storage-engine \
                --with-blackhole-storage-engine \
                --with-federated-storage-engine \
                --with-big-tables $servertype"
[5 Jun 2007 19:26] Valeriy Kravchuk
Thank you for a problem report. I can not repeat the problem with latest 5.0.44-BK on 32-bit SuSE Linux:

openxs@suse:~/dbs/5.0> uname -a
Linux suse 2.6.11.4-20a-default #1 Wed Mar 23 21:52:37 UTC 2005 i686 i686 i386 GNU/Linux

So, it may be x86_64-specific bug.
[6 Jun 2007 4:55] Valeriy Kravchuk
Do you have this problem on Debian? If yes, please, check if Bug #27168 (or bug #28690) is related.
[6 Jul 2007 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".