Changeset 242555 in webkit


Ignore:
Timestamp:
Mar 6, 2019 11:20:53 AM (5 years ago)
Author:
sihui_liu@apple.com
Message:

Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
https://bugs.webkit.org/show_bug.cgi?id=195073
<rdar://problem/48285200>

Reviewed by Geoffrey Garen.

r240931 removed a retain cycle between IDBConnectionToServer and IDBConnectionToServerDelegate, so
IDBConnectionToServerDelegate, or InProcessIDBServer would not live forever. When IDBDatabase is gone,
InProcessIDBServer would schedule a notifification to IDBServer with databaseConnectionClosed. IDBServer would
then notify UniqueIDBDatabase. When UniqueIDBDatabase finds all database connections are gone, it would acquires
its only reference pointer from IDBServer schedule and perform a shutdown that kills its database task queue.

The assertion failure tells us UniqueIDBDatabase was destructed at when IDBServer was destructed, which means
UniqueIDBDatabase had not acquired its pointer. It's probably because UniqueIDBDatabase had unfinished tasks or
the operation timer function had not been executed. Since UniqueIDBDatabase needs to complete shutdown process,
we should make IDBServer live as long as UniqueIDBDatabase by keeping a reference pointer of IDBServer in
UniqueIDBDatabase.

  • Modules/indexeddb/server/UniqueIDBDatabase.cpp:

(WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
(WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
(WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
(WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
(WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
(WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
(WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):

  • Modules/indexeddb/server/UniqueIDBDatabase.h:

(WebCore::IDBServer::UniqueIDBDatabase::server):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242534 r242555  
     12019-03-06  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
     4        https://bugs.webkit.org/show_bug.cgi?id=195073
     5        <rdar://problem/48285200>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        r240931 removed a retain cycle between IDBConnectionToServer and IDBConnectionToServerDelegate, so
     10        IDBConnectionToServerDelegate, or InProcessIDBServer would not live forever. When IDBDatabase is gone,
     11        InProcessIDBServer would schedule a notifification to IDBServer with databaseConnectionClosed. IDBServer would
     12        then notify UniqueIDBDatabase. When UniqueIDBDatabase finds all database connections are gone, it would acquires
     13        its only reference pointer from IDBServer schedule and perform a shutdown that kills its database task queue.
     14
     15        The assertion failure tells us UniqueIDBDatabase was destructed at when IDBServer was destructed, which means
     16        UniqueIDBDatabase had not acquired its pointer. It's probably because UniqueIDBDatabase had unfinished tasks or
     17        the operation timer function had not been executed. Since UniqueIDBDatabase needs to complete shutdown process,
     18        we should make IDBServer live as long as UniqueIDBDatabase by keeping a reference pointer of IDBServer in
     19        UniqueIDBDatabase.
     20
     21        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
     22        (WebCore::IDBServer::UniqueIDBDatabase::UniqueIDBDatabase):
     23        (WebCore::IDBServer::UniqueIDBDatabase::deleteBackingStore):
     24        (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose):
     25        (WebCore::IDBServer::UniqueIDBDatabase::openBackingStore):
     26        (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTask):
     27        (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply):
     28        (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete):
     29        (WebCore::IDBServer::UniqueIDBDatabase::notifyServerAboutClose):
     30        * Modules/indexeddb/server/UniqueIDBDatabase.h:
     31        (WebCore::IDBServer::UniqueIDBDatabase::server):
     32
    1332019-03-06  Rob Buis  <rbuis@igalia.com>
    234
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp

    r242136 r242555  
    5656
    5757UniqueIDBDatabase::UniqueIDBDatabase(IDBServer& server, const IDBDatabaseIdentifier& identifier)
    58     : m_server(server)
     58    : m_server(&server)
    5959    , m_identifier(identifier)
    6060    , m_operationAndTransactionTimer(*this, &UniqueIDBDatabase::operationAndTransactionTimerFired)
     
    246246        m_backingStoreIsEphemeral = false;
    247247    } else {
    248         auto backingStore = m_server.createBackingStore(identifier);
     248        auto backingStore = m_server->createBackingStore(identifier);
    249249
    250250        IDBDatabaseInfo databaseInfo;
     
    278278
    279279    RELEASE_ASSERT(!m_owningPointerForClose);
    280     m_owningPointerForClose = m_server.closeAndTakeUniqueIDBDatabase(*this);
     280    m_owningPointerForClose = m_server->closeAndTakeUniqueIDBDatabase(*this);
    281281
    282282    notifyServerAboutClose(CloseState::Start);
     
    637637
    638638    ASSERT(!m_backingStore);
    639     m_backingStore = m_server.createBackingStore(identifier);
     639    m_backingStore = m_server->createBackingStore(identifier);
    640640    m_backingStoreSupportsSimultaneousTransactions = m_backingStore->supportsSimultaneousTransactions();
    641641    m_backingStoreIsEphemeral = m_backingStore->isEphemeral();
     
    17641764{
    17651765    m_databaseQueue.append(WTFMove(task));
    1766     m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTask));
     1766    m_server->postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTask));
    17671767}
    17681768
     
    17701770{
    17711771    m_databaseReplyQueue.append(WTFMove(task));
    1772     m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTaskReply));
     1772    m_server->postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTaskReply));
    17731773}
    17741774
     
    18991899    // Otherwise, this database is still potentially active.
    19001900    // So we'll have it own itself and then perform a clean unconditional delete on the background thread.
    1901     m_owningPointerForClose = m_server.closeAndTakeUniqueIDBDatabase(*this);
     1901    m_owningPointerForClose = m_server->closeAndTakeUniqueIDBDatabase(*this);
    19021902    postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performUnconditionalDeleteBackingStore));
    19031903}
     
    19771977#if PLATFORM(IOS_FAMILY)
    19781978    if (state == CloseState::Start)
    1979         m_server.closeDatabase(this);
     1979        m_server->closeDatabase(this);
    19801980    else
    1981         m_server.didCloseDatabase(this);
     1981        m_server->didCloseDatabase(this);
    19821982#else
    19831983    UNUSED_PARAM(state);
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h

    r242136 r242555  
    8383
    8484    const IDBDatabaseInfo& info() const;
    85     IDBServer& server() { return m_server; }
     85    IDBServer& server() { return *m_server; }
    8686    const IDBDatabaseIdentifier& identifier() const { return m_identifier; }
    8787
     
    230230    void notifyServerAboutClose(CloseState);
    231231
    232     IDBServer& m_server;
     232    RefPtr<IDBServer> m_server;
    233233    IDBDatabaseIdentifier m_identifier;
    234234   
Note: See TracChangeset for help on using the changeset viewer.