← Back to team overview

maria-developers team mailing list archive

Re: [patch 08/11] Fix Valgrind warning of uninitialized data.

 

Hi!

>>>>> "knielsen" == knielsen  <knielsen@xxxxxxxxxxxxxxx> writes:

knielsen> After implementing pool_of_threads, the thd->connect_utime and
thd-> start_utime are not always correctly initialized (depending on
knielsen> which thread model is used).

knielsen> === modified file 'sql/mysqld.cc'
knielsen> ---
knielsen>  sql/mysqld.cc    |    1 +
knielsen>  sql/scheduler.cc |    1 +
knielsen>  2 files changed, 2 insertions(+)

knielsen> Index: sql/mysqld.cc
knielsen> ===================================================================
knielsen> --- sql/mysqld.cc.orig	2009-04-07 13:42:09.000000000 +0200
knielsen> +++ sql/mysqld.cc	2009-04-07 13:42:18.000000000 +0200
knielsen> @@ -4839,6 +4839,7 @@ void handle_connection_in_main_thread(TH
knielsen>    safe_mutex_assert_owner(&LOCK_thread_count);
knielsen>    thread_cache_size=0;			// Safety
knielsen>    threads.append(thd);
knielsen> +  thd->connect_utime= thd->start_utime= my_micro_time();

Couldn't find any way how connect_utime could be used uninitialized.

This is only used in handle_one_connection(), to calculate the time it
took to start a thread.

start_utime is initialized in THD::THD() to 0 and to my_micro_time()
at the start of a query.

In which case was it used wrongly?

knielsen>    (void) pthread_mutex_unlock(&LOCK_thread_count);
knielsen>    handle_one_connection((void*) thd);
knielsen>  }
knielsen> Index: sql/scheduler.cc
knielsen> ===================================================================
knielsen> --- sql/scheduler.cc.orig	2009-04-07 13:40:35.000000000 +0200
knielsen> +++ sql/scheduler.cc	2009-04-07 13:42:18.000000000 +0200
knielsen> @@ -470,6 +470,7 @@ static void libevent_add_connection(THD 
knielsen>      DBUG_VOID_RETURN;
knielsen>    }
knielsen>    threads.append(thd);
knielsen> +  thd->connect_utime= thd->start_utime= my_micro_time();
knielsen>    libevent_thd_add(thd);
 
Same questions as for above.

Regards,
Monty



References