Bug #14080 | Bus error in mysql_real_connect on connects from Sparc64 to i386 | ||
---|---|---|---|
Submitted: | 17 Oct 2005 17:31 | Modified: | 2 May 2007 18:04 |
Reporter: | Christian Hammers (Silver Quality Contributor) (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.x | OS: | Linux (Debian GNU/Linux) |
Assigned to: | CPU Architecture: | Any | |
Tags: | qc |
[17 Oct 2005 17:31]
Christian Hammers
[17 Oct 2005 17:33]
Christian Hammers
Some more info: > "cat /etc/host.conf" Root kant:[~] > cat /etc/host.conf order hosts,bind multi on > "cat /etc/hosts" Root kant:[~] > cat /etc/hosts 127.0.0.1 localhost 192.168.254.1 kant.astelys.fr kant # Comment rparer les conneries de Monsieur Free ! 82.229.72.155 deu95-1-82-229-72-155.fbx.proxad.net # The following lines are desirable for IPv6 capable hosts # (added automatically by netbase upgrade) ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts > "ldd /usr/bin/mysql" Root kant:[~] > ldd /usr/bin/mysql libreadline.so.5 => /lib/libreadline.so.5 (0x70030000) libncurses.so.5 => /lib/libncurses.so.5 (0x70074000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x700d0000) libmysqlclient.so.14 => /usr/lib/libmysqlclient.so.14 (0x701b8000) libcrypt.so.1 => /lib/libcrypt.so.1 (0x702e8000) libnsl.so.1 => /lib/libnsl.so.1 (0x70328000) libz.so.1 => /usr/lib/libz.so.1 (0x70350000) libm.so.6 => /lib/libm.so.6 (0x70374000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x70408000) libc.so.6 => /lib/libc.so.6 (0x70424000) libdl.so.2 => /lib/libdl.so.2 (0x7055c000) /lib/ld-linux.so.2 (0x70000000) > "host <name of i386 host>" Root kant:[~] > host alain alain.astelys.fr has address 192.168.0.130 > ltrace output instead of strace output There is no ltrace on debian/sparc. I have downloaded the tarball and built ltrace (with link from sparc to sparc64 in ~/ltrace-0.3.36/sysdeps/linux-gnu). I hope my ltrace is a regular ltrace... Root kant:[~/ltrace-0.3.36] > ./ltrace mysql -uroot -p -halain __libc_start_main(104328, 4, 0xeffffdc4, 113424, 113544 <unfinished ...> _init(0, 0, 0, 0, 0 <unfinished ...> <... __libc_start_main resumed> ) = 0x7002ccb0 __cxa_atexit(93436, 0, 192928, 0, 0) = 0 __cxa_atexit(93372, 0, 192928, 0, 0) = 0 __cxa_atexit(91020, 0, 192928, 0x7002ce64, 0) = 0 get_defaults_files(4, 0xeffffdc4, 0xeffffcf4, 0xeffffcf0, 0) = 4 my_init(4, 0xeffffdc4, 0xeffffcf4, 0xeffffcf0, 0) = 0 getenv(124928, 0xeffffdc4, 0xeffffcf4, 0xeffffcf0, 0) = 0 my_strdup(124944, 16, 0xeffffcf4, 0xeffffcf0, 0) = 221264 my_strdup(221264, 16, 0xeffffcf4, 0xeffffcf0, 0) = 221280 getenv(124952, 8, 0xeffffcf4, 0xeffffcf0, 0) = 0 isatty(0, 8, 0xeffffcf4, 0xeffffcf0, 0) = 1 isatty(1, 8, 0xeffffcf4, 0xeffffcf0, 0) = 1 load_defaults(120552, 193784, 0xeffffd44, 0xeffffd48, 0) = 0 mysql_get_parameters(0, 221832, 0xeffffd44, 0xeffffd48, 0) = 0x7020dc6c getenv(124960, 221832, 0xeffffd44, 0xeffffd48, 0) = 0 getenv(124952, 221832, 0xeffffd44, 0xeffffd48, 0) = 0 strcpy(207728, 203584, 0xeffffd44, 0xeffffd48, 0) = 207728 handle_options(0xeffffce8, 0xeffffcec, 193800, 81648, 0x7472feff) = 0 strcmp(114008, 0x701f9ac0, 676, 2800, 206848) = 0 get_tty_password(0, 0x701f9ac8, 0x1010101, 0x80808080, 0x6e310000Enter password: ) = 221512 mysql_server_init(1, 0xeffffcdc, 198088, 0x80808080, 0x6e310000) = 0 my_malloc(520, 16, 0, 0, 0) = 225136 breakpointed at 0x2ec74 (?) my_malloc(12, 48, 0, 0, 0) = 221616 init_alloc_root(199440, 8192, 0, 0, 0) = 199440 init_alloc_root(199400, 16384, 0, 0x80808080, 0x6e310000) = 199400 memset(198344, 0, 952, 0x80808080, 0x6e310000) = 198344 mysql_init(198344, 0, 0, 0, 0) = 198344 mysql_real_connect(198344, 221368, 221352, 221512, 0 <unfinished ...> --- SIGBUS (Bus error) --- +++ killed by SIGBUS +++ strace returns: open("/etc/host.conf", O_RDONLY) = 4 fstat64(4, {st_dev=makedev(8, 1), st_ino=32620, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=8192, st_blocks=8, st_size=26, st_atime=2005/10/17-11:55:38, st_mtime=1995/09/26-05:20:44, st_ctime=2003/12/14-13:31:48}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7001c000 read(4, "order hosts,bind\nmulti on\n", 8192) = 26 read(4, "", 8192) = 0 close(4) = 0 munmap(0x7001c000, 8192) = 0 open("/etc/hosts", O_RDONLY) = 4 fcntl64(4, F_GETFD) = 0 fcntl64(4, F_SETFD, FD_CLOEXEC) = 0 fstat64(4, {st_dev=makedev(8, 1), st_ino=32710, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=8192, st_blocks=8, st_size=407, st_atime=2005/10/17-11:55:38, st_mtime=2005/10/17-09:45:58, st_ctime=2005/10/17-09:45:59}) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7001c000 read(4, "127.0.0.1\tlocalhost\n192.168.254."..., 8192) = 407 --- SIGBUS (Bus error) @ 0 (0) --- +++ killed by SIGBUS +++
[17 Oct 2005 17:36]
MySQL Verification Team
Hi! Please specify which package you used on sparc64. Is it 32-bit or 64-bit libmysqlclient ?? A stacktrace from SIGBUS would be nice too ... Last, but not least, a snippet of code and a line where SIGBUS occurs would be welcome.
[17 Oct 2005 19:21]
Christian Hammers
Hello Some more information by Joel: Root kant:[/usr/lib] > file libmysqlclient.so.14.0.0 libmysqlclient.so.14.0.0: ELF 32-bit MSB shared object, SPARC, version 1 (SYSV), stripped Root kant:[/usr/lib] > uname -a Linux kant 2.6.10 #6 Mon Feb 21 14:56:15 CET 2005 sparc64 GNU/Linux I have launched gdb on the so-obtained core: Root kant:[/usr/lib] > gdb /usr/bin/mysql core GNU gdb 6.3-debian Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-linux"...(no debugging symbols found) Using host libthread_db library "/lib/libthread_db.so.1". Core was generated by `mysql -uroot -p -halain'. Program terminated with signal 10, Bus error. Reading symbols from /lib/libreadline.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libreadline.so.5 Reading symbols from /lib/libncurses.so.5...(no debugging symbols found)...done. Loaded symbols for /lib/libncurses.so.5 Reading symbols from /usr/lib/libstdc++.so.6... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libstdc++.so.6 Reading symbols from /usr/lib/libmysqlclient.so.14...(no debugging symbols found)...done. Loaded symbols for /usr/lib/libmysqlclient.so.14 Reading symbols from /lib/libcrypt.so.1... (no debugging symbols found)...done. Loaded symbols for /lib/libcrypt.so.1 Reading symbols from /lib/libnsl.so.1...(no debugging symbols found)...done. Loaded symbols for /lib/libnsl.so.1 Reading symbols from /usr/lib/libz.so.1... (no debugging symbols found)...done. Loaded symbols for /usr/lib/libz.so.1 Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/libgcc_s.so.1... (no debugging symbols found)...done. Loaded symbols for /lib/libgcc_s.so.1 Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/libdl.so.2... (no debugging symbols found)...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done. Loaded symbols for /lib/ld-linux.so.2 Reading symbols from /lib/libnss_files.so.2... (no debugging symbols found)...done. Loaded symbols for /lib/libnss_files.so.2 #0 0x705779cc in _nss_files_endhostent () from /lib/libnss_files.so.2 (gdb) bt #0 0x705779cc in _nss_files_endhostent () from /lib/libnss_files.so.2 #1 0x70577fcc in _nss_files_gethostbyname_r () from /lib/libnss_files.so.2 #2 0x70500274 in gethostbyname_r () from /lib/libc.so.6 #3 0x701db898 in my_gethostbyname_r () from /usr/lib/libmysqlclient.so.14 #4 0x701f3c8c in mysql_real_connect () from /usr/lib/libmysqlclient.so.14 #5 0x00015068 in mysql_store_result_for_lazy () #6 0x00019b04 in main () (gdb)
[20 Oct 2005 11:55]
MySQL Verification Team
Hi! Thanks a lot on your feedback. I see that you use 32 bit binary on sparc64. What I would like to know is whether a kernel and system libs are 32 or 64 bit on that sparc64 linux ?? If 64-bit then, it is evidently a problem with system libraries not handling 32-bit calls properly.
[20 Oct 2005 14:35]
Joël BERTRAND
Hello, On Debian/sparc, only kernel works with 64 bits. Before my last dist-upgrade, all mysql connections worked between all workstations (mysql 4.0). Regards, JKB
[21 Oct 2005 14:01]
MySQL Verification Team
This is not first time that we see 32-bit calls failing on 64-bit system. But you can check it out by manually changing config.h, specifically: #define HAVE_GETHOSTBYNAME_R 1 #define HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1 Try undefining both and re-run complete make.
[22 Nov 2005 0: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".
[22 Nov 2005 0:07]
Christian Hammers
Sorry, one user feedback did not make it from the Debian BTS to your one. -christian- -------------------------------------------- From: BERTRAND Joël <joel.bertrand@systella.fr> To: Christian Hammers <ch@debian.org> Cc: 334339@bugs.debian.org Subject: Re: Bug#334339: News from mysql.com Date: Thu, 17 Nov 2005 12:16:05 +0100 Hello Christian, > On 2005-10-25 BERTRAND Joël wrote: > >> I have received from mysql.com : >> >>This is not first time that we see 32-bit calls failing on 64-bit >>system. But you can check it out by manually changing config.h, >>specifically: >> >>#define HAVE_GETHOSTBYNAME_R 1 >>#define HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1 >> >>Try undefining both and re-run complete make. >> >> I shall try. > > > Did you try? Any news? I have tried with the official sources (mysql-4.1.15) that come from www.mysql.com web page. if g++ -DMYSQL_SERVER -DDEFAULT_MYSQL_HOME="\"/export/home/bertrand/mysql\"" -DDATADIR="\"/export/home/bertrand/mysql/var\"" -DSHAREDIR="\"/export/home/bertrand/mysql/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../innobase/include -I../include -I../include -I../regex -I. -O3 -DDBUG_OFF -fno-implicit-templates -fno-exceptions -fno-rtti -MT sql_analyse.o -MD -MP -MF ".deps/sql_analyse.Tpo" -c -o sql_analyse.o sql_analyse.cc; \ then mv -f ".deps/sql_analyse.Tpo" ".deps/sql_analyse.Po"; else rm -f ".deps/sql_analyse.Tpo"; exit 1; fi sql_analyse.cc: In member function 'virtual void field_longlong::add()': sql_analyse.cc:506: internal compiler error: in invert_exp_1, at jump.c:1719 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>. make[4]: *** [sql_analyse.o] Erreur 1 make[4]: quittant le répertoire « /export/home/bertrand/mysql/mysql-4.1.15/sql » make[3]: *** [all-recursive] Erreur 1 make[3]: quittant le répertoire « /export/home/bertrand/mysql/mysql-4.1.15/sql » make[2]: *** [all] Erreur 2 make[2]: quittant le répertoire « /export/home/bertrand/mysql/mysql-4.1.15/sql » make[1]: *** [all-recursive] Erreur 1 make[1]: quittant le répertoire « /export/home/bertrand/mysql/mysql-4.1.15 » make: *** [all] Erreur 2 kant:[~/mysql/mysql-4.1.15] > This bug comes from g++-4.0. I have compiled this source with g++-3.3. I have tried to connect to my server and the connection can be established : kant:[~/mysql/mysql-4.1.15/client] > ./mysql -uroot -p -halain Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 103 to server version: 4.1.14-Debian_6-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> Best regards, JKB
[23 Nov 2005 18:20]
Valeriy Kravchuk
I had discussed your last results with Sinisa, and here is the summary: Sorry, but if different compilers gives different (even incorrect) results on the same source and platform it looks like a compiler bug, not a MySQL bug. So, please, do not use GCC 4.x.x for compiling MySQL, at least, on 64 bit platforms. gethostbyname() has nothing to do with sql_analyze.*, so it is irrelevant.
[14 Jun 2006 23:27]
Jonas Ådahl
I can confirm that changing #define HAVE_GETHOSTBYNAME_R 1 #define HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE 1 to #undef HAVE_GETHOSTBYNAME_R #undef HAVE_GETHOSTBYNAME_R_GLIBC2_STYLE solves the Bus Error crash. I compiled using gcc-4.0.4 on Debian SPARC. The manually compiled one were the same version (and had the same patches) as the one that was installed with apt.
[6 Apr 2007 0:34]
Christian Hammers
In http://bugs.debian.org/334339 people are reporting this bug to be still present, /usr/bin/mysql on Sparc crashes when accessing an i386 server (maybe other combinations, too). They also report that changing the mentioned HAVE_GETHOSTBYNAME_R lines help. bye, -christian-
[6 Apr 2007 5:31]
Valeriy Kravchuk
Thank you for the update. As previous workaround still works, I think, this is still a bug in gcc or glibc on this 64-bit kernel/32-bit userland platform. Please, add gcc/glibc version combinatios that are affected.
[2 May 2007 18:04]
Christian Hammers
It seems this was indeed a glibc bug that has been fixed in version 2.5. according to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=334339 bye, -christian-