• Ahmad Abdullateef's avatar
    BUG#14727815 - CRASH IN PTHREAD_RWLOCK_WRLOCK/SRW_UNLOCK · 6d82d9c9
    Ahmad Abdullateef authored
                                 IN QUERY CACHE CODE
    
    DESCRIPTION:
    MySQL Server crashes sporadically when Query Caching is on and
    the server has high contention among clients. 
    
    
    ANALYSIS :
    
    Scenario 1:
    In Query_cache::move_by_type() when handling RESULT or its related blocks,
    Write Lock is acquired on its parent Query block. However the next and prev
    pointers are cached in local variables before lock acquisition. In an extremely
    high contention scenario there exists a possibility that
    Query_cache::append_result_data() is operating on the same query block
    and as a consequence might append a new Result block to the end of Result
    blocks Linked List of the Query. This would manipulate the next, prev pointers
    of the Block being processed in move_by_type(), however the local pointers
    still point to previous nodes there by causing Data Corruption leading to crash.
    
    FIX :
    
    Scenario 1:
    The next, prev pointers are now accessed only after Lock acquisition in 
    Query_cache::move_by_type().
    6d82d9c9
sql_cache.cc 145 KB