Description:
Hi,
I don't know if this bug is a NetBSD or MySQL issue, can you tell me how to correct it if this is a mysql bug ?
GNU gdb 5.3nb1
Copyright 2002 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--netbsdelf"...(no debugging symbols found)...
(gdb) run --basedir=/usr/pkg/mysql --datadir=/usr/space/mysql --user=mysql --pid-file=/usr/space/mysql/db0.pid --port=3306
Starting program: /usr/pkg/mysql/libexec/mysqld --basedir=/usr/pkg/mysql --datadir=/usr/space/mysql --user=mysql --pid-file=/usr/space/mysql/db0.pid --port=3306
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 9]
0x9fac6ede in __bt_search () from /usr/lib/libc.so.12
(gdb) where
#0 0x9fac6ede in __bt_search () from /usr/lib/libc.so.12
#1 0x9fac99b0 in __dtoa () from /usr/lib/libc.so.12
#2 0x9fac4ef2 in __vfprintf_unlocked () from /usr/lib/libc.so.12
#3 0x9fac4a70 in __vfprintf_unlocked () from /usr/lib/libc.so.12
#4 0x9fab4547 in sprintf () from /usr/lib/libc.so.12
#5 0x080bc871 in Field_double::val_str(String*, String*) ()
#6 0x08060d3e in Field::val_str(String*) ()
#7 0x080d6e87 in Protocol_simple::store(Field*) ()
#8 0x0805c1a2 in Item_field::send(Protocol*, String*) ()
#9 0x080cdda5 in select_send::send_data(List<Item>&) ()
#10 0x0813f9ee in end_send(JOIN*, st_join_table*, bool) ()
#11 0x0813e24f in evaluate_join_record(JOIN*, st_join_table*, int, char*) ()
#12 0x0813e00c in sub_select(JOIN*, st_join_table*, bool) ()
#13 0x0813dc77 in do_select(JOIN*, List<Item>*, st_table*, Procedure*) ()
#14 0x0812e182 in JOIN::exec() ()
#15 0x0812e59f in mysql_select(THD*, Item***, st_table_list*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned long, select_result*, st_select_lex_unit*, st_select_lex*) ()
#16 0x0812a224 in handle_select(THD*, st_lex*, select_result*, unsigned long)
()
#17 0x080f40cf in mysql_execute_command(THD*) ()
#18 0x080fb8e8 in mysql_parse(THD*, char*, unsigned) ()
#19 0x080f2608 in dispatch_command(enum_server_command, THD*, char*, unsigned)
---Type <return> to continue, or q <return> to quit---
()
#20 0x080f1f86 in do_command(THD*) ()
#21 0x080f146a in handle_one_connection ()
#22 0x9fbdd17d in pthread_create () from /usr/lib/libpthread.so.0
(gdb) quit
This bug is reproductible, if you have multiple select on tables and you do mysqldump -C -q -e -A multiple times... The same trace appear at each segfault
I try to replace sprintf with snprintf and to_length argument but the bug appear again... Here is the new trace with snprintf:
GNU gdb 5.3nb1
Copyright 2002 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--netbsdelf"...(no debugging symbols found)...
(gdb) run --basedir=/usr/pkg/mysql --datadir=/usr/space/mysql --user=mysql --pid-file=/usr/space/mysql/db0.pid --port=3306
Starting program: /usr/pkg/mysql/libexec/mysqld --basedir=/usr/pkg/mysql --datadir=/usr/space/mysql --user=mysql --pid-file=/usr/space/mysql/db0.pid --port=3306
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
(no debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 7]
0x9fac6ede in __bt_search () from /usr/lib/libc.so.12
(gdb) where
#0 0x9fac6ede in __bt_search () from /usr/lib/libc.so.12
#1 0x9fac99b0 in __dtoa () from /usr/lib/libc.so.12
#2 0x9fac4ef2 in __vfprintf_unlocked () from /usr/lib/libc.so.12
#3 0x9fac4a70 in __vfprintf_unlocked () from /usr/lib/libc.so.12
#4 0x9fac137c in snprintf () from /usr/lib/libc.so.12
#5 0x080bc874 in Field_double::val_str(String*, String*) ()
#6 0x08060d3e in Field::val_str(String*) ()
#7 0x080d6e87 in Protocol_simple::store(Field*) ()
#8 0x0805c1a2 in Item_field::send(Protocol*, String*) ()
#9 0x080cdda5 in select_send::send_data(List<Item>&) ()
#10 0x0813f9ee in end_send(JOIN*, st_join_table*, bool) ()
#11 0x0813e24f in evaluate_join_record(JOIN*, st_join_table*, int, char*) ()
#12 0x0813e040 in sub_select(JOIN*, st_join_table*, bool) ()
#13 0x0813dc77 in do_select(JOIN*, List<Item>*, st_table*, Procedure*) ()
#14 0x0812e182 in JOIN::exec() ()
#15 0x0812e59f in mysql_select(THD*, Item***, st_table_list*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned long, select_result*, st_select_lex_unit*, st_select_lex*) ()
#16 0x0812a224 in handle_select(THD*, st_lex*, select_result*, unsigned long)
()
#17 0x080f40cf in mysql_execute_command(THD*) ()
#18 0x080fb8e8 in mysql_parse(THD*, char*, unsigned) ()
#19 0x080f2608 in dispatch_command(enum_server_command, THD*, char*, unsigned)
---Type <return> to continue, or q <return> to quit---
()
#20 0x080f1f86 in do_command(THD*) ()
#21 0x080f146a in handle_one_connection ()
#22 0x9fbdd17d in pthread_create () from /usr/lib/libpthread.so.0
(gdb) quit
The program is running. Exit anyway? (y or n) y
How to repeat:
run mysqldump -C -q -e -A multiple times with concurrency selects
Suggested fix:
Don't know at this time