Commit 2336e0b3 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-20206 : Crash inside timer_callback()[threadpool_win.cc:419]

The most likely cause of the crash is that a timer fired, after it was closed.

MSDN documents such a possibility, in the documentation for
CloseThreadpoolTimer() function, and recommends disabling the timer before
calling WaitForThreadpoolTimerCallbacks()/CloseThreadpoolTimer().

The fix follows this recommendation.

Note, that 5.5-10.1 disabled the timer before close, but this code
was lost in threadpool refactoring in 10.2
parent a895c68c
...@@ -308,6 +308,7 @@ TP_connection_win::~TP_connection_win() ...@@ -308,6 +308,7 @@ TP_connection_win::~TP_connection_win()
if (timer) if (timer)
{ {
SetThreadpoolTimer(timer, 0, 0, 0);
WaitForThreadpoolTimerCallbacks(timer, TRUE); WaitForThreadpoolTimerCallbacks(timer, TRUE);
CloseThreadpoolTimer(timer); CloseThreadpoolTimer(timer);
} }
......
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