diff options
author | unknown <sasha@mysql.sashanet.com> | 2001-03-24 23:33:26 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2001-03-24 23:33:26 -0700 |
commit | 20a5872e69b349e9c893fed488669cffd4b7bd52 (patch) | |
tree | d85f91a3b5bdca0bf45adfb75c78a83a596ae534 /sql | |
parent | 4a3f651d6dcd050b5a213ed141fc5c70ce5500e8 (diff) | |
download | mariadb-git-20a5872e69b349e9c893fed488669cffd4b7bd52.tar.gz |
sql/mysqld.cc
fixed concurrency bug with a very quickly disconnecting client -
the client could disconnect and delete thd before pthread_create
could write to &thd->real_id
sql/sql_list.h
while tracking down the bug, made new/delete go through my_malloc/my_free
for ilink - did not help, but this is better anyway - cleaner exit with a message in
out of memory codition at least.
sql/mysqld.cc:
fixed concurrency bug with a very quickly disconnecting client -
the client could disconnect and delete thd before pthread_create
could write to &thd->real_id
sql/sql_list.h:
while tracking down the bug, made new/delete go through my_malloc/my_free
for ilink - did not help, but this is better anyway - cleaner exit with a message in
out of memory codition at least.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/sql_list.h | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f45614bd0a1..f4649a792b4 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2091,7 +2091,6 @@ static void create_new_thread(THD *thd) threads.append(thd); DBUG_PRINT("info",(("creating thread %d"), thd->thread_id)); thd->connect_time = time(NULL); - (void) pthread_mutex_unlock(&LOCK_thread_count); if ((error=pthread_create(&thd->real_id,&connection_attrib, handle_one_connection, (void*) thd))) @@ -2099,7 +2098,6 @@ static void create_new_thread(THD *thd) DBUG_PRINT("error", ("Can't create thread to handle request (error %d)", error)); - (void) pthread_mutex_lock(&LOCK_thread_count); thread_count--; thd->killed=1; // Safety (void) pthread_mutex_unlock(&LOCK_thread_count); @@ -2110,6 +2108,8 @@ static void create_new_thread(THD *thd) (void) pthread_mutex_unlock(&LOCK_thread_count); DBUG_VOID_RETURN; } + + (void) pthread_mutex_unlock(&LOCK_thread_count); } } DBUG_PRINT("info",(("Thread %d created"), thd->thread_id)); diff --git a/sql/sql_list.h b/sql/sql_list.h index 965d1ff9308..b86250f70b6 100644 --- a/sql/sql_list.h +++ b/sql/sql_list.h @@ -225,6 +225,15 @@ public: struct ilink { struct ilink **prev,*next; + static void *operator new(size_t size) + { + return (void*)my_malloc((uint)size, MYF(MY_WME | MY_FAE)); + } + static void operator delete(void* ptr_arg, size_t size) + { + my_free((gptr)ptr_arg, MYF(MY_WME|MY_ALLOW_ZERO_PTR)); + } + inline ilink() { prev=0; next=0; |