Skip to content

Commit 4b9d594

Browse files
BUG#22867809 - MY_WRITE, MY_PWRITE NO LONGER SAFE TO CALL
FROM THD-LESS SERVER UTILITY THREADS. If my_write system write calls writes fewer bytes than requested, the code will check whether the current connection has received a KILL. If my_write is called from a server utility thread, there is no THD context associated with it. Hence current_thd doesn't exist and it will fail. The fix is to check current_thd before using it.
1 parent d26e090 commit 4b9d594

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql/sql_class.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3762,7 +3762,7 @@ void THD::end_attachable_transaction()
37623762
extern "C" int thd_killed(const MYSQL_THD thd)
37633763
{
37643764
if (thd == NULL)
3765-
return current_thd->killed;
3765+
return current_thd != NULL ? current_thd->killed : 0;
37663766
return thd->killed;
37673767
}
37683768

0 commit comments

Comments
 (0)