Bug #37653 | Errors in mysql_real_connect() function | ||
---|---|---|---|
Submitted: | 26 Jun 2008 5:04 | Modified: | 30 Jun 2008 10:36 |
Reporter: | Il-Ahn Cheong | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S2 (Serious) |
Version: | 5.1.25-rc | OS: | Linux (CentOS4.4) |
Assigned to: | CPU Architecture: | Any | |
Tags: | add_collation, characterset, init_state_maps, mysql_real_connect |
[26 Jun 2008 5:04]
Il-Ahn Cheong
[26 Jun 2008 19:14]
Sveta Smirnova
Thank you for the report. If I understood correctly your program which uses C API crashes some time. If you think this is because bug in MySQL C API, please, provide small program demonstrating such behavior.
[27 Jun 2008 7:33]
Il-Ahn Cheong
This is the result of test program. I uploaded test program's codes. ---- Test Result ---- # gdb test GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) 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 "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) r Starting program: /Dev/test [Thread debugging using libthread_db enabled] [New Thread -1208453440 (LWP 15979)] [New Thread -1208456272 (LWP 15982)] [INFO_THR] Run {Processor1 } thread1(3086511024) [New Thread -1218950224 (LWP 15983)] [INFO_THR] Run {Processor2 } thread2(3076017072) Processor1() Ok... Processor2() Ok... Processor1() Ok... Processor2() Ok... Program received signal SIGINT, Interrupt. [Switching to Thread -1208453440 (LWP 15979)] 0x00b937a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2 (gdb) r The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /Dev/test [Thread debugging using libthread_db enabled] [New Thread -1208346944 (LWP 16009)] [New Thread -1208349776 (LWP 16010)] [INFO_THR] Run {Processor1 } thread1(3086617520) [New Thread -1218843728 (LWP 16011)] [INFO_THR] Run {Processor2 } thread2(3076123568) Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1208349776 (LWP 16010)] 0x00461961 in add_collation () from /usr/lib/mysql/libmysqlclient.so.16 (gdb) bt #0 0x00461961 in add_collation () from /usr/lib/mysql/libmysqlclient.so.16 #1 0x0046a7ab in cs_leave () from /usr/lib/mysql/libmysqlclient.so.16 #2 0x0047155d in my_xml_leave () from /usr/lib/mysql/libmysqlclient.so.16 #3 0x00471bea in my_xml_parse () from /usr/lib/mysql/libmysqlclient.so.16 #4 0x0046ac63 in my_parse_charset_xml () from /usr/lib/mysql/libmysqlclient.so.16 #5 0x00461a7f in my_read_charset_file () from /usr/lib/mysql/libmysqlclient.so.16 #6 0x004624c2 in get_charset_by_csname () from /usr/lib/mysql/libmysqlclient.so.16 #7 0x00473857 in mysql_init_character_set () from /usr/lib/mysql/libmysqlclient.so.16 #8 0x004748bf in mysql_real_connect () from /usr/lib/mysql/libmysqlclient.so.16 #9 0x080488fd in processor1 () at test_mysql.c:73 #10 0x00116371 in start_thread () from /lib/tls/libpthread.so.0 #11 0x00c78ffe in clone () from /lib/tls/libc.so.6 --- Test End ----
[27 Jun 2008 7:43]
Sveta Smirnova
Thank you for the feedback. > I uploaded test program's codes. Where did you upload test program codes?
[27 Jun 2008 7:46]
Il-Ahn Cheong
test program's codes
Attachment: test_mysql.c (text/plain), 2.94 KiB.
[27 Jun 2008 7:53]
Il-Ahn Cheong
These are the our environments of MySQL and system. mysql> status -------------- mysql Ver 14.14 Distrib 5.1.22-rc, for redhat-linux-gnu (i686) using EditLine wrapper Connection id: 1050758 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.1.22-rc-log Source distribution Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: latin1 Conn. characterset: latin1 UNIX socket: /tmp/mysql.sock Uptime: 16 days 4 hours 35 min 52 sec Threads: 6 Questions: 11976713 Slow queries: 0 Opens: 59 Flush tables: 1 Open tables: 52 Queries per second avg: 8.561 -------------- mysql> show character set; +----------+-----------------------------+---------------------+--------+ | Charset | Description | Default collation | Maxlen | +----------+-----------------------------+---------------------+--------+ | dec8 | DEC West European | dec8_swedish_ci | 1 | | cp850 | DOS West European | cp850_general_ci | 1 | | hp8 | HP West European | hp8_english_ci | 1 | | koi8r | KOI8-R Relcom Russian | koi8r_general_ci | 1 | | latin1 | cp1252 West European | latin1_swedish_ci | 1 | | latin2 | ISO 8859-2 Central European | latin2_general_ci | 1 | | swe7 | 7bit Swedish | swe7_swedish_ci | 1 | | ascii | US ASCII | ascii_general_ci | 1 | | hebrew | ISO 8859-8 Hebrew | hebrew_general_ci | 1 | | koi8u | KOI8-U Ukrainian | koi8u_general_ci | 1 | | greek | ISO 8859-7 Greek | greek_general_ci | 1 | | cp1250 | Windows Central European | cp1250_general_ci | 1 | | latin5 | ISO 8859-9 Turkish | latin5_turkish_ci | 1 | | armscii8 | ARMSCII-8 Armenian | armscii8_general_ci | 1 | | utf8 | UTF-8 Unicode | utf8_general_ci | 3 | | cp866 | DOS Russian | cp866_general_ci | 1 | | keybcs2 | DOS Kamenicky Czech-Slovak | keybcs2_general_ci | 1 | | macce | Mac Central European | macce_general_ci | 1 | | macroman | Mac West European | macroman_general_ci | 1 | | cp852 | DOS Central European | cp852_general_ci | 1 | | latin7 | ISO 8859-13 Baltic | latin7_general_ci | 1 | | cp1251 | Windows Cyrillic | cp1251_general_ci | 1 | | cp1256 | Windows Arabic | cp1256_general_ci | 1 | | cp1257 | Windows Baltic | cp1257_general_ci | 1 | | binary | Binary pseudo charset | binary | 1 | | geostd8 | GEOSTD8 Georgian | geostd8_general_ci | 1 | +----------+-----------------------------+---------------------+--------+ 26 rows in set (0.00 sec) #dmesg Linux version 2.6.9-42.ELsmp (buildcentos@build-i386) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 SMP Sat Aug 12 09:39:11 CDT 2006 ....... # gcc --version gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-3) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[28 Jun 2008 16:41]
Sveta Smirnova
Thank you for the feedback. You use multiple threads. Please link with thread-safe client library libmysqlclient_r instead of libmysqlclient, try with it and inform us if you meet this error again.
[30 Jun 2008 7:33]
Il-Ahn Cheong
Thank you very much! That problem was like solved. However, a problem is occrred. When test program runned, sometimes first connection was failed and next connection retry was success. #./test [INFO_THR] Run {Processor1 } thread1(3086187440) [INFO_THR] Run {Processor2 } thread2(3075693488) [*WARNING*] Not connect to mysql server : ERROR(2003)= Can't connect to MySQL server on 'localhost' (111) # ./test [INFO_THR] Run {Processor1 } thread1(3086494640) [INFO_THR] Run {Processor2 } thread2(3076000688) Processor1() Ok... Processor2() Ok... Processor2() Ok... Processor1() Ok... ... What is something wrong? I'd like to ask advice of you.
[30 Jun 2008 10:13]
Sveta Smirnova
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug. Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/ Thank you for your interest in MySQL. Error 111 is "Connection refused". You should track why connection is refused. Probably using mysqld option log-warnings=2.
[30 Jun 2008 10:36]
Il-Ahn Cheong
Thank you for your help. ^^