maria-developers team mailing list archive
Mailing list archive
Re: Problem with debug_sync, THD::enter_cond(), and kill ...
On Feb 26, Kristian Nielsen wrote:
> I got a crash in my parallel replication test case, and this one turned out to
> be caused by a fundamental problem in debug_sync. I am not sure how to solve
> it, so I wanted to explain the issue in case others have some ideas.
> The crash happens in THD::awake() when a thread is killed:
> int ret= mysql_mutex_trylock(mysys_var->current_mutex);
> if (!ret)
> The problem is that mysys_var->current_mutex changed between the trylock() and
> the unlock(), so we unlock a different mutex than the one we locked - ouch!
What about saving mysys_var->current_mutex locally before trylock-ing
it? Then you can be sure that you unlock what you've locked.
Races are still possible, you can signal a condition that doesn't
correspond to the mutex - but it doesn't really matter here.