Bug #40244 Optimized build of mysqld crashes when built with Sun Studio on SPARC
Submitted: 22 Oct 2008 12:51 Modified: 12 Nov 2009 19:10
Reporter: Olav Sandstå Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S1 (Critical)
Version:6.0.8-alpha OS:Solaris (SPARC64)
Assigned to: Zhenxing He CPU Architecture:Any
Tags: pushbuild, Sun Studio

[22 Oct 2008 12:51] Olav Sandstå
Description:
When building an optimized version of MySQL using the Sun Studio optimizer on SPARC mysqld core dumps during startup.

This is also happens when starting mysql-test-run.pl where it fails to start due to mysqld core dumps.

Doing a trace of the command mysql-test-run.pl executes when this happens:

/home/os136802/mysql/develop/repo/falcon-sparc-tmp/sql/mysqld --no-defaults --datadir=/tmp/olav --language=/home/os136802/mysql/develop/repo/falcon-sparc-tmp/sql/share/english --skip-grant-tables --verbose --help --core-file

(note: --core-file flag added by me)

The resulting core file contains the following call stack:

(dbx) where
current thread: t@1
  [1] __lwp_kill(0x0, 0xa, 0x0, 0x0, 0x0, 0x0), at 0xffffffff7ded3894 
=>[2] my_write_core(sig = ???) (optimized), at 0x1008814bc (line ~307) in "stacktrace.c"
  [3] handle_segfault(sig = ???) (optimized), at 0x10033be3c (line ~2671) in "mysqld.cc"
  [4] __sighndlr(0xa, 0x0, 0xffffffff7fffea20, 0x10033bb78, 0x0, 0x0), at 0xffffffff7ded2798 
  ---- called from signal handler with signal 10 (SIGBUS) ------
  [5] base_list::empty(this = ???) (optimized), at 0x10028b2b8 (line ~99) in "lex_hash.h"
  [6] base_list::base_list(this = ???) (optimized), at 0x10028b978 (line ~100) in "sql_list.h"
  [7] List<Observer_info>::List(this = ???) (optimized), at 0x1004a3814 (line ~380) in "sql_list.h"
  [8] Delegate::Delegate(this = ???) (optimized), at 0x1004a3694 (line ~120) in "sql_string.h"
  [9] Trans_delegate::Trans_delegate(this = ???) (optimized), at 0x1004a3344 (line ~141) in "sql_string.h"
  [10] delegates_init() (optimized), at 0x1004a1fc0 (line ~98) in "rpl_handler.cc"
  [11] init_server_components() (optimized), at 0x10033e138 (line ~3955) in "mysqld.cc"
  [12] main(argc = ???, argv = ???) (optimized), at 0x10033f078 (line ~4576) in "mysqld.cc"

How to repeat:
Reproduce:

1. Check out mysql from mysql-6.0 branch (or mysql-6.0-falcon-team which used)

2. On a SPARC machine do the following configure:

./configure CC=/opt/studio12/SUNWspro/bin/cc CXX=/opt/studio12/SUNWspro/bin/CC CFLAGS="-g -O2 -Xa -xstrconst -mt -D_FORTEC_ -m64" CXXFLAGS="-g -O2 -noex -mt -D_FORTEC_ -m64" --prefix=/home/os136802/install/mysql6-sparc  --with-named-curses=-lcurses --with-mysql-ldflags=-static --with-client-ldflags=-static --with-plugins=myisam,innobase,falcon --enable-dtrace

3. compile..

4. Try to start mysqld done by mysql-test-run.pl:

/home/os136802/mysql/develop/repo/falcon-sparc-tmp/sql/mysqld --no-defaults --datadir=/tmp/olav --language=/home/os136802/mysql/develop/repo/falcon-sparc-tmp/sql/share/english --skip-grant-tables --verbose --help --core-file

Suggested fix:
mysqld should not crash during startup.
[23 Oct 2008 9:49] Olav Sandstå
Compiled the same binaries for 32 bit SPARC (just changed -m64 to -m32) and did the same test. No problems seen so it seems to be a problem with 64 bit SPARC binaries, not on 32 bit SPARC binaries.
[31 Oct 2008 5:04] Zhenxing He
Patch has already been pushed to mysql-6.0-alik, and merged to mysql-6.0 by alik
[16 Mar 2009 17:11] Paul Dubois
Noted in 6.0.8 changelog.

Optimized builds of mysqld crashed when built with Sun Studio on
SPARC platforms.
[30 Sep 2009 11:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/85190

3110 He Zhenxing	2009-09-30
      Backporting BUG#40244 Optimized build of mysqld crashes when built with Sun Studio on SPARC
[27 Oct 2009 9:50] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20091027094604-9p7kplu1vd2cvcju) (version source revid:zhenxing.he@sun.com-20091026140226-uhnqejkyqx1aeilc) (merge vers: 6.0.14-alpha) (pib:13)
[27 Oct 2009 13:57] Paul Dubois
Already fixed in 6.0.8.
[12 Nov 2009 8:21] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091110093229-0bh5hix780cyeicl) (version source revid:alik@sun.com-20091027095744-rf45u3x3q5d1f5y0) (merge vers: 5.5.0-beta) (pib:13)
[12 Nov 2009 19:10] Paul Dubois
Noted in 5.5.0 changelog.