[tpcc-mysql] Segmentation fault

Bug #1084839 reported by UCHIKAWA Yoshiaki
6
This bug affects 1 person
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_arg[t_num].port= port;
     thd_arg[t_num].number= t_num;
@@ -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[((num_node * t_num)/num_conn)];
@@ -741,6 +736,7 @@

   /* EXEC SQL DISCONNECT; */
   mysql_close(ctx[t_num]);
+ 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."

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.