Hi, Alexey!
On Feb 27, Alexey Kopytov wrote:
> 2812 Alexey Kopytov 2009-02-27
> Fix for bug #40552: Race condition around default_directories
> in load_defaults()
>
> load_defaults(), my_search_option_files() and
> my_print_default_files() utilized a global variable
> containing a pointer to thread local memory. This could lead
> to race conditions when those functions were called with high
> concurrency.
>
> === modified file 'sql-common/client.c'
> --- a/sql-common/client.c 2008-03-29 08:02:54 +0000
> +++ b/sql-common/client.c 2009-02-27 09:26:06 +0000
> @@ -1021,7 +1021,7 @@ void mysql_read_default_options(struct s
> argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
> groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
>
> - load_defaults(filename, groups, &argc, &argv);
> + my_load_defaults(filename, groups, &argc, &argv, NULL);
Hm. I expected you'll pass a local buffer here. Why NULL ? How you're
going to free the memorz allocated in my_load_defaults() ?
Note when merging into 5.1 - Gluh has added load_defaults() call to
sql_plugin.cc, you'll need to change that to a thread-safe version too,
as that place may be run concurrently by many threads.
Regards / Mit vielen Grüßen,
Sergei
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Sergei Golubchik <serg@stripped>
/ /|_/ / // /\ \/ /_/ / /__ Principal Software Engineer/Server Architect
/_/ /_/\_, /___/\___\_\___/ Sun Microsystems GmbH, HRB München 161028
<___/ Sonnenallee 1, 85551 Kirchheim-Heimstetten
Geschäftsführer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Häring