Bug 196827

Summary: Take an assertion if there is open database connection
Product: WebKit Reporter: Sihui Liu <sihui_liu>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: achristensen, beidson, cdumez, ggaren
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch cdumez: review-

Sihui Liu
Reported 2019-04-11 12:42:54 PDT
Currently network process and web process ask for an assertion when transactionInProgressCount is not zero, and this value is changed in many places where there is a database activity on an open database connection. This could be error-prone and slow. Why don't we just count the open databases instead of running database operations?
Attachments
Patch (31.12 KB, patch)
2019-04-11 13:04 PDT, Sihui Liu
cdumez: review-
Sihui Liu
Comment 1 2019-04-11 13:04:41 PDT
Chris Dumez
Comment 2 2019-04-11 13:05:31 PDT
My understanding was that it is OK to suspend while databases are open. It is only not OK when there are pending transactions because the database file is locked when there is an operation running. I believe holding an assertion whenever there is an open database would be a significant power regression.
Chris Dumez
Comment 3 2019-04-11 13:06:22 PDT
Comment on attachment 367234 [details] Patch r- due to my earlier comments. If my understanding is wrong somehow, let me know.
Sihui Liu
Comment 4 2019-04-11 13:29:16 PDT
(In reply to Chris Dumez from comment #2) > My understanding was that it is OK to suspend while databases are open. It > is only not OK when there are pending transactions because the database file > is locked when there is an operation running. > > I believe holding an assertion whenever there is an open database would be a > significant power regression. I thought about this. If this is the case, why do we closeAllDatabases when ProcessWillSuspendImminently? We could just let the running transaction be finished or interrupted? Also, if this causes big power regression, shouldn't we find all the places that could have database connection open for a long time but not actually doing anything and close them? I was told we are not supposed to keep open database connection when there is no database activity.
Brady Eidson
Comment 5 2019-04-11 15:19:34 PDT
(In reply to Chris Dumez from comment #2) > My understanding was that it is OK to suspend while databases are open. Actually simply having an open sqlite3* connection that isn't doing thing makes it so we cannot suspend. *sigh* That said, I agree with your power observation here and Sihui and I discussed a good way forward.
Note You need to log in before you can comment on or make changes to this bug.