Title: [242555] trunk/Source/WebCore
- Revision
- 242555
- Author
- [email protected]
- Date
- 2019-03-06 11:20:53 -0800 (Wed, 06 Mar 2019)
Log 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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (242554 => 242555)
--- trunk/Source/WebCore/ChangeLog 2019-03-06 19:10:06 UTC (rev 242554)
+++ trunk/Source/WebCore/ChangeLog 2019-03-06 19:20:53 UTC (rev 242555)
@@ -1,3 +1,35 @@
+2019-03-06 Sihui Liu <[email protected]>
+
+ 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):
+
2019-03-06 Rob Buis <[email protected]>
Consider supporting the `referrerpolicy` attribute.
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (242554 => 242555)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-03-06 19:10:06 UTC (rev 242554)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp 2019-03-06 19:20:53 UTC (rev 242555)
@@ -55,7 +55,7 @@
namespace IDBServer {
UniqueIDBDatabase::UniqueIDBDatabase(IDBServer& server, const IDBDatabaseIdentifier& identifier)
- : m_server(server)
+ : m_server(&server)
, m_identifier(identifier)
, m_operationAndTransactionTimer(*this, &UniqueIDBDatabase::operationAndTransactionTimerFired)
{
@@ -245,7 +245,7 @@
m_backingStoreSupportsSimultaneousTransactions = false;
m_backingStoreIsEphemeral = false;
} else {
- auto backingStore = m_server.createBackingStore(identifier);
+ auto backingStore = m_server->createBackingStore(identifier);
IDBDatabaseInfo databaseInfo;
auto error = backingStore->getOrEstablishDatabaseInfo(databaseInfo);
@@ -277,7 +277,7 @@
m_operationAndTransactionTimer.stop();
RELEASE_ASSERT(!m_owningPointerForClose);
- m_owningPointerForClose = m_server.closeAndTakeUniqueIDBDatabase(*this);
+ m_owningPointerForClose = m_server->closeAndTakeUniqueIDBDatabase(*this);
notifyServerAboutClose(CloseState::Start);
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::shutdownForClose));
@@ -636,7 +636,7 @@
LOG(IndexedDB, "(db) UniqueIDBDatabase::openBackingStore (%p)", this);
ASSERT(!m_backingStore);
- m_backingStore = m_server.createBackingStore(identifier);
+ m_backingStore = m_server->createBackingStore(identifier);
m_backingStoreSupportsSimultaneousTransactions = m_backingStore->supportsSimultaneousTransactions();
m_backingStoreIsEphemeral = m_backingStore->isEphemeral();
@@ -1763,13 +1763,13 @@
void UniqueIDBDatabase::postDatabaseTask(CrossThreadTask&& task)
{
m_databaseQueue.append(WTFMove(task));
- m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTask));
+ m_server->postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTask));
}
void UniqueIDBDatabase::postDatabaseTaskReply(CrossThreadTask&& task)
{
m_databaseReplyQueue.append(WTFMove(task));
- m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTaskReply));
+ m_server->postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::executeNextDatabaseTaskReply));
}
void UniqueIDBDatabase::executeNextDatabaseTask()
@@ -1898,7 +1898,7 @@
notifyServerAboutClose(CloseState::Start);
// Otherwise, this database is still potentially active.
// So we'll have it own itself and then perform a clean unconditional delete on the background thread.
- m_owningPointerForClose = m_server.closeAndTakeUniqueIDBDatabase(*this);
+ m_owningPointerForClose = m_server->closeAndTakeUniqueIDBDatabase(*this);
postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performUnconditionalDeleteBackingStore));
}
@@ -1976,9 +1976,9 @@
ASSERT(isMainThread());
#if PLATFORM(IOS_FAMILY)
if (state == CloseState::Start)
- m_server.closeDatabase(this);
+ m_server->closeDatabase(this);
else
- m_server.didCloseDatabase(this);
+ m_server->didCloseDatabase(this);
#else
UNUSED_PARAM(state);
#endif
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (242554 => 242555)
--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2019-03-06 19:10:06 UTC (rev 242554)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h 2019-03-06 19:20:53 UTC (rev 242555)
@@ -82,7 +82,7 @@
void openDatabaseConnection(IDBConnectionToClient&, const IDBRequestData&);
const IDBDatabaseInfo& info() const;
- IDBServer& server() { return m_server; }
+ IDBServer& server() { return *m_server; }
const IDBDatabaseIdentifier& identifier() const { return m_identifier; }
void createObjectStore(UniqueIDBDatabaseTransaction&, const IDBObjectStoreInfo&, ErrorCallback);
@@ -229,7 +229,7 @@
void notifyServerAboutClose(CloseState);
- IDBServer& m_server;
+ RefPtr<IDBServer> m_server;
IDBDatabaseIdentifier m_identifier;
ListHashSet<RefPtr<ServerOpenDBRequest>> m_pendingOpenDBRequests;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes