Bug #28661 Segfault when compiling
Submitted: 24 May 2007 17:45 Modified: 7 Sep 2007 7:18
Reporter: Fred Tyler Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.41 OS:Linux
Assigned to: CPU Architecture:Any

[24 May 2007 17:45] Fred Tyler
Description:
I'm getting a segfault when compiling mysql 5.0.41 on a pure x86_64 system. It doesn't appear to affect the compilation (i.e. mysql keeps compiling anyway), and the segfault is reported on the console, not from the compile output itself.

Here is what is printed on the system console:

May 24 17:25:09 b1 kernel: factorial[5885]: segfault at 0000000000020f51 rip 0000000000403afb rsp 00007fff41f07f20 error 4
May 24 17:25:09 b1 kernel: factorial[5888]: segfault at 0000000000020f51 rip 0000000000403afb rsp 00007fffeca3aa70 error 4
May 24 17:25:09 b1 kernel: factorial[5891]: segfault at 0000000000020f51 rip 0000000000403afb rsp 00007fff429859c0 error 4
May 24 17:25:09 b1 kernel: factorial[5894]: segfault at 0000000000020f51 rip 0000000000403afb rsp 00007fff779b69f0 error 4
May 24 17:25:09 b1 kernel: factorial[5897]: segfault at 0000000000020f51 rip 0000000000403afb rsp 00007fff846e4710 error 4

And here is the approximate point in the compilation where the segfault message is triggered:

gcc -fPIC -O3 -DDBUG_OFF ../mysys/libmysys.a ../strings/libmystrings.a -lpthread -lcrypt -lnsl -lm -lpthread
/bin/rm -f example1.r
/bin/sed -e 's!\\!\\\\!g' example1.c > example1.r
/bin/rm -f example2.r
/bin/sed -e 's!\\!\\\\!g' example2.c > example2.r
/bin/rm -f example3.r
/bin/sed -e 's!\\!\\\\!g' example3.c > example3.r
/bin/rm -f main.r
/bin/sed -e 's!\\!\\\\!g' main.c > main.r
/bin/rm -f factorial.r
/bin/sed -e 's!\\!\\\\!g' factorial.c > factorial.r
./factorial 1 2 3 4 5 | cat > output1.r
./factorial -\#t:o 2 3 | cat >output2.r
./factorial -\#d:t:o 3 | cat >output3.r
./factorial -\#d,result:o 4 | cat >output4.r
./factorial -\#d:f,factorial:F:L:o 3 | cat >output5.r
nroff -mm user.r > user.t
user.r:204: warning: can't find font `C'
user.r:773: warning [p 15, 5.8i]: can't break line
user.r:785: warning [p 15, 8.0i]: can't break line
user.r:795: warning [p 15, 9.8i]: can't break line
user.r:812: warning [p 16, 3.7i]: can't break line
user.r:814: warning [p 16, 3.8i]: cannot adjust line
user.r:1038: warning: indent cannot be negative
groff -mm user.r > user.ps

Here is a possibly relevant post to lkml where someone else was seeing a similar 
problem:

    http://lkml.org/lkml/2005/11/23/508

Also, here is someone who was seeing the exact same thing as I am, but the page is in Russian so I don't understand it. I don't know if there was a solution posted at the end of this thread or not, but if you have someone there who speaks Russian maybe they can see what the solution was:

    http://www.opennet.ru/openforum/vsluhforumID1/73788.html

How to repeat:
Compile mysql 5.0.41 on Linux x86_64. Watch the console output, or the kern log messages.
[25 May 2007 8:54] Valeriy Kravchuk
Thank you for a problem report. Please, send the resuls of:

uname -a
free
gcc --version

and exact ./configure command line used.
[25 May 2007 18:04] Fred Tyler
root@srv$ uname -a       
Linux b0 2.6.20.11 #1 SMP Thu May 24 18:29:52 GMT 2007 x86_64 GNU/Linux

root@srv$ free   
             total       used       free     shared    buffers     cached
Mem:        383084     196508     186576          0      36988      58736
-/+ buffers/cache:     100784     282300
Swap:      1048568          0    1048568

root@srv$ gcc --version
gcc (GCC) 4.1.2

Configure command:  ./configure --prefix=/tmp/test/mysql
[26 May 2007 9:48] Valeriy Kravchuk
Do you have any other gcc version to check? 4.2.0 or odler 3.x.y?
[1 Jun 2007 22:36] George Frisch
Hi , i see the same error messages :

2.6.19-gentoo-r5_Feb07

gcc --version
gcc (GCC) 3.4.6 (Gentoo 3.4.6-r2, ssp-3.4.6-1.0, pie-8.7.10)

emerge (3 of 143) dev-db/mysql-5.0.40

dmesg
....
[ 9938.198051] factorial[14043]: segfault at 0000000000020f51 rip 0000000000403512 rsp 00007fff948c78b0 error 4
[ 9938.203807] factorial[14046]: segfault at 0000000000020f51 rip 0000000000403512 rsp 00007fff3a8e08e0 error 4
[ 9938.213782] factorial[14049]: segfault at 0000000000020f51 rip 0000000000403512 rsp 00007fff86b96ba0 error 4
[ 9938.222230] factorial[14052]: segfault at 0000000000020f51 rip 0000000000403512 rsp 00007fff923cd3c0 error 4
[ 9938.228522] factorial[14054]: segfault at 0000000000020f51 rip 0000000000403512 rsp 00007fffbc375380 error 4
[26 Jun 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".
[30 Jul 2007 8:19] ho han
I see the same error messages in some server
have AMD opteron Processor 248 (maybe 64 bit, dual core)
I want to really really fix it!

# uname -a
Linux - 2.6.9-42.ELsmp #1 SMP Wed Jul 12 23:32:02 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux

# free
             total       used       free     shared    buffers     cached
Mem:       3995472     668204    3327268          0      58696     512844
-/+ buffers/cache:      96664    3898808
Swap:      4192956          0    4192956

# gcc --version
gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3)
[2 Aug 2007 11:05] Sveta Smirnova
Thank you for the report.

Please try with version 5.0.45 and say us result.
[3 Aug 2007 2:11] Intzi Intzi
Hi!

I try to setup mysql-5.0.45 from source but I face with the same segfault problem

I have debian etch + rsbac AMD64 on Opteron 170 (dualcore) + 4g ram

---------------------------------------------------------------------------

uname -a

Linux antaeus 2.6.22.1-rsbac #2 SMP Wed Aug 1 03:56:20 CEST 2007 x86_64 GNU/Linux

gcc -v

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release x86_64-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

free

             total       used       free     shared    buffers     cached
Mem:       4046236     880048    3166188          0     380544     379736
-/+ buffers/cache:     119768    3926468
Swap:       979832          0     979832

---------------------------------------------------------------------------

I've tried with these ./configure:

1) ./configure
2) ./configure --prefix=/usr/locale/mysql
3) ./configure CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
   ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static

and also TRIED WITH gcc-3.3 and gcc-3.4

and everytime I get these lines:
factorial[24612]: segfault at 0000000000020ec1 rip 00000000004038ac rsp 00007fff212e1ad0 error 4
factorial[24618]: segfault at 0000000000020ec1 rip 00000000004038ac rsp 00007fffabd64570 error 4
factorial[24623]: segfault at 0000000000020ec1 rip 00000000004038ac rsp 00007fff4d0ff910 error 4
factorial[24631]: segfault at 0000000000020ec1 rip 00000000004038ac rsp 00007fffd1c8b490 error 4
factorial[24616]: segfault at 00000000000208b1 rip 00000000004038ac rsp 00007fffabd64560 error 4

Thanks in advance,
Intzi
[4 Aug 2007 8:54] Intzi Intzi
Hi!

./configure --with-debug

with this option the problem doesn't appear!
[2 Sep 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".
[3 Sep 2007 18:58] Sergei Golubchik
start a non-debug build to repeat
e.g.  BUILD/compile-pentium
[3 Sep 2007 18:59] Sergei Golubchik
on x86_64 at least :)
[7 Sep 2007 7:18] Daniel Fischer
This is a duplicate of bug#14420.

This bug is not harmful. The "factorial" program is an example for dbug. The segfault has no impact on mysql itself.