Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 674b378249dd2ac78888412e09e5f7b727153783
      
https://github.com/WebKit/WebKit/commit/674b378249dd2ac78888412e09e5f7b727153783
  Author: Sihui Liu <[email protected]>
  Date:   2026-07-29 (Wed, 29 Jul 2026)

  Changed paths:
    M Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
    M Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/IndexedDBSuspendImminently.mm

  Log Message:
  -----------
  REGRESSION(315609@main): Aborting many in-progress transactions of a 
suspended process can cause stack overflow
https://bugs.webkit.org/show_bug.cgi?id=320598
rdar://182837687

Reviewed by Chris Dumez.

Aborting one suspended-client transaction can recurse into aborting the next 
one, forming a chain like:
handleTransactions()
  -> abortInProgressTransactionsBlockedOnSuspendedClients()
        -> transactionCompleted()
          -> handleTransactions()
                -> abortInProgressTransactionsBlockedOnSuspendedClients()
                  -> transactionCompleted()
                        -> ...

Each transactionCompleted() call re-enters handleTransactions(), which re-enters
abortInProgressTransactionsBlockedOnSuspendedClients() to abort the next 
transaction, before the previous call has
returned. With enough blocked transactions from a suspended client, this chain 
gets deep enough to overflow the stack.

Break the chain: have the abort loop pass ShouldStartRunnableWork::No to 
transactionCompleted() so it only updates the
transaction bookkeeping and does not call back into handleTransactions(). Once 
every transaction in the batch has been
aborted, run handleDatabaseOperations()/handleTransactions() a single time, 
instead of once per aborted transaction.

API test: IndexedDB.AbortMultipleTransactionsOfSuspendedProcess

* Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted):
(WebCore::IDBServer::UniqueIDBDatabase::abortInProgressTransactionsBlockedOnSuspendedClients):
* Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/IndexedDBSuspendImminently.mm:
(AbortMultipleTransactionsOfSuspendedProcess)):

Canonical link: https://commits.webkit.org/318222@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to