Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index




On 2015-06-02 03:07 PM, Lionel Elie Mamane wrote:
Hi,

I found a race condition between

1) connectivity::hsqldb::ODriverDelegator::flushConnections()
    (in file connectivity/source/drivers/hsqldb/HDriver.cxx around line 620)
    walking over m_aConnections

2) connectivity::hsqldb::ODriverDelegator::disposing()
    (same file around line 565)
    calling

         m_aConnections.clear();
         TWeakPairVector().swap(m_aConnections);

    which invalidates the iterators used by flushConnection()

Plus also probably, race condition between flushConnections() calling
flush() and disposing() disposing the underlying connection (although
this is probably handled correctly by the exception catching...).


I would suggest something like this in ODriverDelegator::flushConnections():

    take_mutex();
    std::vector<Connection> tmp = m_aConnections;
    release_mutex();
    for (Connection conn : tmp)
        conn.flush();

so that the mutex is not held during the problematic phase

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.