[tpcc-mysql] Segmentation fault
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
percona-tools |
New
|
Undecided
|
Unassigned |
Bug Description
x86_64 GNU/Linux (Debian squeeze ) kernel 2.6.31.6
MySQL version 5.1.47
./tpcc_start -h xxx -d tpcc -u testtpcc -p xxxxxx -w 40 -c 10 -l 30 -r 20
*******
*** ###easy### TPC-C Load Generator ***
*******
option h with value 'xxx'
option d with value 'tpcc'
option u with value 'testtpcc'
option p with value 'xxxxxx'
option l with value '30'
option r with value '20'
option w with value '40'
option c with value '10'
<Parameters>
[server]: xxx
[port]: 3306
[DBname]: tpcc
[user]: testtpcc
[pass]: xxxxxx
[warehouse]: 40
[connection]: 10
[rampup]: 20 (sec.)
[measure]: 30 (sec.)
Segmentation fault
== FIX ==
--- main.c.orig 2012-11-22 13:02:09.733314000 +0900
+++ main.c 2012-11-30 10:46:00.000000000 +0900
@@ -390,13 +390,6 @@
exit(1);
}
- /* EXEC SQL WHENEVER SQLERROR GOTO sqlerr; */
-
- for( i=0; i < num_conn; i++ ){
- ctx[i] = mysql_init(NULL);
- if(!ctx[i]) goto sqlerr;
- }
-
for( t_num=0; t_num < num_conn; t_num++ ){
thd_
thd_
@@ -667,6 +660,8 @@
db_string_ptr = db_string;
/* EXEC SQL WHENEVER SQLERROR GOTO sqlerr;*/
+ ctx[t_num] = mysql_init(NULL);
+ if(!ctx[t_num]) goto sqlerr;
if(num_node > 0){ /* RAC mode */
db_string_ptr = node_string[
@@ -741,6 +736,7 @@
/* EXEC SQL DISCONNECT; */
mysql_
+ mysql_thread_end();
printf(".");
fflush(stdout);
==
In MySQL Document (21.9.16.2. How to Write a Threaded Client )
"When you call mysql_init(), MySQL creates a thread-specific variable for the thread that is used by the debug library (among other things). If you call a MySQL function before the thread has called mysql_init(), the thread does not have the necessary thread-specific variables in place and you are likely to end up with a core dump sooner or later."