Skip to content

Commit 08b0b70

Browse files
committed
MDEV-24084 Fix race between disconnect and KILL CONNECTION
Prior to this patch, it is possible to access freed memory (THD::event_scheduler) from tp_post_kill_notification(). With this patch, memory is freed only when THD is no more accessible from other threads, i.e after it is removed from the thread_list.
1 parent 75e7132 commit 08b0b70

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sql/threadpool_common.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,11 @@ void tp_callback(TP_connection *c)
202202

203203
error:
204204
c->thd= 0;
205-
delete c;
206-
207205
if (thd)
208206
{
209207
threadpool_remove_connection(thd);
210208
}
209+
delete c;
211210
worker_context.restore();
212211
}
213212

0 commit comments

Comments
 (0)