• Vladislav Vaintroub's avatar
    MDEV-4566 : Failing DBUG_ASSERT() in SELECT SLEEP(), with threadpool. · 08ce9bfe
    Vladislav Vaintroub authored
    This bug only happens with long sleep()s ( > 5 sec), and in debug version.
    
    Analysis: 
    The assertion is caused by nested thd_wait_begin() calls, which is not an expected condition.
    -  "outer" thd_wait_begin()) , in Item_func_sleep::val_int()
    -  "inner" thd_wait_begin() in Interruptible_wait::wait(). This function periodically checks whether connection is still valid, via THD::is_connection(), which ends up  calling vio_io_wait()  with timeout parameter set to  0.
    
    
    Fix is not to call thd wait callback in vio_io_wait(), if timeout parameter is 0. There is no "waiting" in this case.
    08ce9bfe
viosocket.c 35 KB