Bug #23814 mysqlimport crashes
Submitted: 31 Oct 2006 18:58 Modified: 13 Mar 2007 18:59
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.1.12-beta OS:some Unix (64 bit only, but not all)
Assigned to: Alexey Kopytov CPU Architecture:Any

[31 Oct 2006 18:58] Joerg Bruehe
Description:
Occurred in 5.1.12-beta:

mysqldump                      [ fail ]

Errors are (from /export/home/mysqldev/butch-64bit/test/mysql-5.1.12-beta-solaris9-sparc-64bit/mysql-test/var/log/mysqltest-time) :
Bus Error - core dumped
mysqltest: At line 655: command "$MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/t1.txt" failed
(the last lines may be the most important ones)
Result from queries before failure can be found in r/mysqldump.log

===---===---===---===---===---===--- OCCURRED:
butch-64bit-5.1-community.log   normal
butch-64bit-5.1-community.log   ps
butch-64bit-5.1-community.log   normal+rowrepl
butch-64bit-5.1-community.log   ps+rowrepl+NDB
hpita2-64bit-5.1-community.log   debug
hpita2-64bit-5.1-community.log   normal
hpita2-64bit-5.1-community.log   ps
hpita2-64bit-5.1-community.log   normal+rowrepl
hpita2-64bit-5.1-community.log   ps+rowrepl+NDB
sol10-sparc-a-64bit-5.1-community.log   normal
sol10-sparc-a-64bit-5.1-community.log   ps
sol10-sparc-a-64bit-5.1-community.log   normal+rowrepl
sol10-sparc-a-64bit-5.1-community.log   ps+rowrepl+NDB
sunfire100a-64bit-5.1-community.log   normal
sunfire100a-64bit-5.1-community.log   ps
sunfire100a-64bit-5.1-community.log   normal+rowrepl
sunfire100a-64bit-5.1-community.log   ps+rowrepl+NDB

All of these are 64-bit, mixed big- (Sparc) and little-endian (ia64),
but the test passed on other 64-bit machines (PowerPC, HP-PA, AMD64).

Similar incidents in 5.1.7 and 5.1.11 did not get reported :-(
and were on different machines 
(5.1.7: only HP-ia64 failed; 5.1.11: only Sparc-64 failed)

How to repeat:
Run the test suite.
[31 Oct 2006 18:59] Joerg Bruehe
Fix the OS list ...
[12 Dec 2006 10:04] Francesco Riosa
I think this can be related to:
"bus error" from mysqldump on sparc after upgrade 4.1 to 5.x
http://bugs.gentoo.org/show_bug.cgi?id=157408

this is the mail I've sent to internals@mysql.com and where S.Goulubchik suggested to open a bug.

Hello, as subject tell we are experiencing a regression 4.1 => 5.0 .
Basically "mysqldump" crash with "bus error" on ultrasparc processor.

A slightly more in depth research show that */client.c use multiple times
a suspect cast:

test(*(uint*) arg)

2953      case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
2954        if (!arg || test(*(uint*) arg))
2955          mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;

the cast to work should be aligned at 4 bytes but it's not, for example
we got

with #0  0x701acc2c in mysql_options (mysql=0x2df18,
option=MYSQL_OPT_SSL_VERIFY_SERVER_CERT, arg=0x2deba "")

mod(0x2deba ; 4) == 2

this specific code was last changed to fix BUG#21543 so what I'm asking here
is suggestion on which direction to try:

a) we can try to patch this but some directives would be apreciated
b) simply open a bug report (I cannot guarantee a full report with dumps
and all)

Thanks in advance:
Francesco R.
[19 Jan 2007 8:21] 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/18420

ChangeSet@1.2390, 2007-01-19 11:21:01+03:00, kaa@polly.local +1 -0
  Fix for the bug #23814 "mysqlimport crashes"
  
  mysqlimport.c declared the opt_use_threads variable as my_bool, but the corresponding option was defined as GET_UINT. The problem only occured on architecturs with strict alignment rules.
[19 Jan 2007 11:14] 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/18430

ChangeSet@1.2390, 2007-01-19 14:14:11+03:00, kaa@polly.local +1 -0
  Fix for the bug #23814 "mysqlimport crashes"
  
  mysqlimport.c declared the opt_use_threads variable as my_bool, but the corresponding option was defined as GET_UINT. The problem only occured on architectures with strict alignment rules.
[8 Mar 2007 23:15] Timothy Smith
pushed to 5.1.17
[13 Mar 2007 18:59] Paul Dubois
Noted in 5.1.17 changelog.