Commit 0f8450b2 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-3885 - connection suicide via mysql_kill() causes assertion in server

Assertion happened because sql_kill did not set OK status in diagnostic area
in the case of connection suicide (id to kill == thd->thread_id), issued 
via  COM_PROCESS_KILL , e.g using mysql_kill()

This patch ensures that diagnostic area is initialized in this specific case.
parent 980664bf
......@@ -6717,7 +6717,7 @@ void sql_kill(THD *thd, ulong id, killed_state state)
uint error;
if (!(error= kill_one_thread(thd, id, state)))
{
if (! thd->killed)
if ((!thd->killed) || (thd->thread_id == id))
my_ok(thd);
}
else
......
......@@ -18554,6 +18554,22 @@ static void test_progress_reporting()
mysql_close(conn);
}
/**
MDEV-3885 - connection suicide via mysql_kill() causes assertion in server
*/
static void test_mdev3885()
{
int rc;
MYSQL *conn;
myheader("test_mdev3885");
conn= client_connect(0, MYSQL_PROTOCOL_TCP, 0);
rc= mysql_kill(conn, mysql_thread_id(conn));
DIE_UNLESS(rc == 0);
mysql_close(conn);
}
/**
Bug#57058 SERVER_QUERY_WAS_SLOW not wired up.
......@@ -19056,6 +19072,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug58036", test_bug58036 },
{ "test_bug57058", test_bug57058 },
{ "test_bug56976", test_bug56976 },
{ "test_mdev3855", test_mdev3885 },
{ "test_bug11766854", test_bug11766854 },
{ "test_bug12337762", test_bug12337762 },
{ "test_progress_reporting", test_progress_reporting },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment