Bug 195890

Summary: [iOS] The network process sometimes gets killed for trying to suspend while holding locked files
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit2Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, beidson, commit-queue, ddkilzer, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Chris Dumez 2019-03-18 09:10:26 PDT
The network process sometimes gets killed for trying to suspend while holding locked files:
14  libsqlite3.dylib              	0x00000001e06ecd9c sqlite3LockAndPrepare + 1024 (sqlite3.c:129700)
15  WebCore                       	0x00000001e6588840 WebCore::SQLiteStatement::prepare() + 176 (SQLiteStatement.cpp:74)
16  WebCore                       	0x00000001e65855e4 WebCore::SQLiteDatabase::open(WTF::String const&, bool) + 716 (SQLiteStatement.h:56)
17  WebKit                        	0x00000001d8954478 WTF::Function<void ()>::CallableWrapper<WebKit::NetworkHTTPSUpgradeChecker::NetworkHTTPSUpgradeChecker()::$_14>::call() + 92 (NetworkHTTPSUpgradeChecker.cpp:71)
18  JavaScriptCore                	0x00000001e3eb5bc8 WTF::BlockPtr<void ()> WTF::BlockPtr<void ()>::fromCallable<WTF::WorkQueue::dispatch(WTF::Function<void ()>&&)::$_0>(WTF::WorkQueue::dispatch(WTF::Function<void ()>&&)::$_0)::'lambda'(void*)::__invoke(void*) + 32 (Function.h:56)

The SQLiteDatabaseTracker normally keeps tracking of "transactions" in progress so we know that we're holding locked files and the WebSQLiteDatabaseTracker takes care of notifying the UIProcess via IPC that it should hold a background assertion on our behalf to avoid trying to suspend while holding locked files.
However, we were missing a SQLiteTransactionInProgressAutoCounter when trying to execute the PRAGMA statement.

Note that we have a similar SQLiteTransactionInProgressAutoCounter in SQLiteDatabase::useWALJournalMode() when executing such PRAGMA statement already.
Comment 1 Chris Dumez 2019-03-18 09:10:39 PDT
<rdar://problem/48934338>
Comment 2 Chris Dumez 2019-03-18 09:13:44 PDT
Created attachment 365019 [details]
Patch
Comment 3 Geoffrey Garen 2019-03-18 10:29:42 PDT
Comment on attachment 365019 [details]
Patch

r=me
Comment 4 WebKit Commit Bot 2019-03-18 11:27:47 PDT
Comment on attachment 365019 [details]
Patch

Clearing flags on attachment: 365019

Committed r243085: <https://trac.webkit.org/changeset/243085>
Comment 5 WebKit Commit Bot 2019-03-18 11:27:49 PDT
All reviewed patches have been landed.  Closing bug.