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.
This commit is contained in:
parent
4a3f651d6d
commit
20a5872e69
@ -2091,7 +2091,6 @@ static void create_new_thread(THD *thd)
|
|||||||
threads.append(thd);
|
threads.append(thd);
|
||||||
DBUG_PRINT("info",(("creating thread %d"), thd->thread_id));
|
DBUG_PRINT("info",(("creating thread %d"), thd->thread_id));
|
||||||
thd->connect_time = time(NULL);
|
thd->connect_time = time(NULL);
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
|
||||||
if ((error=pthread_create(&thd->real_id,&connection_attrib,
|
if ((error=pthread_create(&thd->real_id,&connection_attrib,
|
||||||
handle_one_connection,
|
handle_one_connection,
|
||||||
(void*) thd)))
|
(void*) thd)))
|
||||||
@ -2099,7 +2098,6 @@ static void create_new_thread(THD *thd)
|
|||||||
DBUG_PRINT("error",
|
DBUG_PRINT("error",
|
||||||
("Can't create thread to handle request (error %d)",
|
("Can't create thread to handle request (error %d)",
|
||||||
error));
|
error));
|
||||||
(void) pthread_mutex_lock(&LOCK_thread_count);
|
|
||||||
thread_count--;
|
thread_count--;
|
||||||
thd->killed=1; // Safety
|
thd->killed=1; // Safety
|
||||||
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
(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);
|
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void) pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info",(("Thread %d created"), thd->thread_id));
|
DBUG_PRINT("info",(("Thread %d created"), thd->thread_id));
|
||||||
|
@ -225,6 +225,15 @@ public:
|
|||||||
|
|
||||||
struct ilink {
|
struct ilink {
|
||||||
struct ilink **prev,*next;
|
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()
|
inline ilink()
|
||||||
{
|
{
|
||||||
prev=0; next=0;
|
prev=0; next=0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user