Skip to content

Fix race conditions in ontology

Carlos Garnacho requested to merge wip/carlosg/ontology-race into master

From the main commit:

    libtracker-data: Protect ontology objects with a mutex
    
    In the case of readonly connections, we use the ontology gvdb as a
    fast path to regenerate the ontology, and fetch the actual data on
    demand.
    
    However, we use the ontology bits from the query machinery, so
    fetching this data on the fly may collide with other threads
    performing queries that require the same ontology resources. This
    may cause from leaks (because two threads get the same data, but
    one is lost) to crashes (because one thread frees data that the
    other is accessing).
    
    Make all gvdb extraction at a single point for those objects, and
    protect the operation with a mutex. As we can do this once, optimize
    the case that data has been already extracted (not needing a mutex
    lock/unlock then). But obviously, also handle the case that 2 or more
    threads contend on gvdb synchronization.

Fixes: #272 (closed)

Merge request reports