What probably happens is that some other threads reuses the buffer during the mutex_unlock/mutex_lock in
buf_LRU_free_block().
Suggestions:
- Add test that if block changed during call of in buf_LRU_free_block() we don't call buf_flush_page_try()
- Remove the optimization of buf_pool->LRU_list_mutex as it's not safe.
The above code doesn't exist in Innobase and it's probably because of that we don't see this issue with InnoDB.
Some more information (Just got a new crash):
The assert buf_block_ get_state( block) == BUF_BLOCK_FILE_PAGE fails for me because: get_state( block) = BUF_BLOCK_ REMOVE_ HASH
buf_block_
one likely reason is that in the caller buf_page_get_gen() we do just before:
mutex_lock( block-> mutex); free_block( ); unlock( block-> mutex); lock(block- >mutex) ;
call buf_LRU_
mutex_
....
mutex_
What probably happens is that some other threads reuses the buffer during the mutex_unlock/ mutex_lock in free_block( ).
buf_LRU_
Suggestions: free_block( ) we don't call buf_flush_ page_try( ) >LRU_list_ mutex as it's not safe.
- Add test that if block changed during call of in buf_LRU_
- Remove the optimization of buf_pool-
The above code doesn't exist in Innobase and it's probably because of that we don't see this issue with InnoDB.