Bug 25788 - Reloading a page while a database transaction is in progress leaves the database locked.
: Reloading a page while a database transaction is in progress leaves the datab...
Status: RESOLVED DUPLICATE of bug 25711
Product: WebKit
Classification: Unclassified
Component: WebCore Misc.
: 528+ (Nightly build)
: All All
: P2 Normal
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-05-14 04:57 PDT by Ben Murdoch
Modified: 2009-05-19 14:26 PDT (History)
0 users

See Also:


Attachments
Proposed fix. (11.13 KB, patch)
2009-05-14 09:27 PDT, Ben Murdoch
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 ***