Bug 25788

Summary: Reloading a page while a database transaction is in progress leaves the database locked.
Product: WebKit Reporter: Ben Murdoch <benm>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Description Flags
Proposed fix. none

Description Ben Murdoch 2009-05-14 04:57:35 PDT
If the user navigates away from a page whilst a database transaction is in progress, the database lock is never released and subsequent accesses to that database fail.

This is what I think is happening:
- The transaction starts.
- Whilst the transaction is still executing, the user reloads the page.
- In the document::stopAllDatabases method, the database is stopped and the database thread asked to die.
- The page reloads.
- The transaction eventually finishes executing and schedules it's next step in the database thread. However the database thread was asked to die, and so is about to complete, which means the next transaction step is never executed and so the transaction is never committed or rolled back. So, the lock on the database file is never released.

I have a patch to fix and a layout test to verify in the works, should be ready soon.
Comment 1 Ben Murdoch 2009-05-14 09:27:11 PDT
Created attachment 30343 [details]
Proposed fix.

This patch fixes the bug by setting a busy handler for database transactions and running the error steps synchronously should the database the transaction was running on be stopped whilst it is running. The busy handler is needed to make transactions on the new page wait for the old transaction to complete and roll back before running.
Comment 2 Ben Murdoch 2009-05-19 14:24:50 PDT

*** This bug has been marked as a duplicate of 25711 ***