Assertion Failed: m_databaseQueue.isKilled() in UniqueIDBDatabase::~UniqueIDBDatabase()
authorsihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2019 19:20:53 +0000 (19:20 +0000)
committersihui_liu@apple.com <sihui_liu@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Mar 2019 19:20:53 +0000 (19:20 +0000)
commit5e1d7c0fb30ecc7f26c20e41887148ee8c31eda6
tree71c7402c2658b2c3fc276b5cb5db830b0d2bf5ef
parent51cd76edf1fa6ac8ea03ee96db5c0ec385d99c13
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242555 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h