Bug 79308 - [V8] IndexedDB: IDBTransaction objects leak in Workers
Summary: [V8] IndexedDB: IDBTransaction objects leak in Workers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joshua Bell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-22 17:10 PST by Joshua Bell
Modified: 2012-02-24 16:27 PST (History)
11 users (show)

See Also:


Attachments
Patch (4.22 KB, patch)
2012-02-22 17:11 PST, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (17.69 KB, patch)
2012-02-23 13:46 PST, Joshua Bell
no flags Details | Formatted Diff | Diff
Patch (17.03 KB, patch)
2012-02-23 14:37 PST, Joshua Bell
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Bell 2012-02-22 17:10:42 PST
[V8] IndexedDB: IDBTransaction objects leak in Workers
Comment 1 Joshua Bell 2012-02-22 17:11:00 PST
Created attachment 128341 [details]
Patch
Comment 2 Joshua Bell 2012-02-22 17:13:34 PST
http://crbug.com/115341 has repro steps

I have no idea if the patch is complete or sensible, but it appears to address the issue.
Comment 3 Dmitry Lomov 2012-02-22 17:35:33 PST
Comment on attachment 128341 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=128341&action=review

The patch looks good, but will be nice to have tests

> Source/WebCore/ChangeLog:8
> +        No new tests. (OOPS!)

Can we have a layout test for this?
Comment 4 Joshua Bell 2012-02-23 13:46:00 PST
Created attachment 128548 [details]
Patch
Comment 5 Joshua Bell 2012-02-23 13:50:07 PST
(In reply to comment #3)
> Can we have a layout test for this?

Of course! I identified a few more points where Workers call into script (Events, Errors) so those are handled and there are tests.

(Having to trap the Worker's error event in the page is unfortunate.)
Comment 6 Joshua Bell 2012-02-23 13:51:58 PST
dslomov, are there other reviewers I should have take a look at this?
Comment 7 Dmitry Lomov 2012-02-23 14:08:05 PST
(In reply to comment #6)
> dslomov, are there other reviewers I should have take a look at this?

(I am not a reviewer) levin@ and dimich@ would be other people, but I know they are both on vacation.
I'll add abarth@ too. maybe he can review, suggest someone else or trust my judgement.
Comment 8 Adam Barth 2012-02-23 14:19:07 PST
This seems related to https://bugs.webkit.org/show_bug.cgi?id=72063

+rafaelw: thoughts on this patch?
Comment 9 Adam Barth 2012-02-23 14:19:44 PST
This generally seems reasonable to me, but we should check with rafaelw.
Comment 10 Dmitry Lomov 2012-02-23 14:22:47 PST
Comment on attachment 128548 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=128548&action=review

LGTM with nit and other ports' expectations

> LayoutTests/fast/js/resources/js-test-pre.js:469
> +    };

nit: Is this required for this fix? We try to avoid unnecessary style changes bundled with patches. Ditto other places.

> LayoutTests/storage/indexeddb/transaction-abort-workers-expected.txt:1
> +[Worker] Test IndexedDB workers, recursion, and transaction termination.

Do JSC ports work fine on this test?
Comment 11 Joshua Bell 2012-02-23 14:27:28 PST
(In reply to comment #10)
> (From update of attachment 128548 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=128548&action=review
> 
> LGTM with nit and other ports' expectations
> 
> > LayoutTests/fast/js/resources/js-test-pre.js:469
> > +    };
> 
> nit: Is this required for this fix? We try to avoid unnecessary style changes bundled with patches. Ditto other places.

Not required; I'll pull it out.

> 
> > LayoutTests/storage/indexeddb/transaction-abort-workers-expected.txt:1
> > +[Worker] Test IndexedDB workers, recursion, and transaction termination.
> 
> Do JSC ports work fine on this test?

Only the Chromium/V8 currently enables IndexedDB; see https://bugs.webkit.org/show_bug.cgi?id=45110
Comment 12 Dmitry Lomov 2012-02-23 14:29:51 PST
(In reply to comment #11)
> (In reply to comment #10)
> > (From update of attachment 128548 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=128548&action=review
> > 
> > LGTM with nit and other ports' expectations
> > 
> > > LayoutTests/fast/js/resources/js-test-pre.js:469
> > > +    };
> > 
> > nit: Is this required for this fix? We try to avoid unnecessary style changes bundled with patches. Ditto other places.
> 
> Not required; I'll pull it out.
> 
> > 
> > > LayoutTests/storage/indexeddb/transaction-abort-workers-expected.txt:1
> > > +[Worker] Test IndexedDB workers, recursion, and transaction termination.
> > 
> > Do JSC ports work fine on this test?
> 
> Only the Chromium/V8 currently enables IndexedDB; see https://bugs.webkit.org/show_bug.cgi?id=45110

Right so this test will fail on those ports wouldn't it? You should add it to the appropriate platform/*/Skipped
Comment 13 Joshua Bell 2012-02-23 14:32:17 PST
(In reply to comment #12)> 
> Right so this test will fail on those ports wouldn't it? You should add it to the appropriate platform/*/Skipped

All of storage/indexeddb is skipped on all of the non-Chromium platforms.
Comment 14 Dmitry Lomov 2012-02-23 14:33:59 PST
(In reply to comment #13)
> (In reply to comment #12)> 
> > Right so this test will fail on those ports wouldn't it? You should add it to the appropriate platform/*/Skipped
> 
> All of storage/indexeddb is skipped on all of the non-Chromium platforms.

Got it - thanks!
Comment 15 Joshua Bell 2012-02-23 14:37:28 PST
Created attachment 128558 [details]
Patch
Comment 16 David Grogan 2012-02-23 20:03:19 PST
Comment on attachment 128558 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=128558&action=review

LGTM, FWIW

> LayoutTests/fast/js/resources/js-test-pre.js:463
> +    return worker;

Thanks for adding this, I had to add it locally for something else.

> LayoutTests/storage/indexeddb/resources/transaction-abort-workers.js:37
> +    evalAndLog("store = transaction.objectStore('store')");

Before this patch, none of these event handlers would be called?

> LayoutTests/storage/indexeddb/resources/transaction-abort-workers.js:50
> +function recursionTest()

This still worked before this patch, right?

> LayoutTests/storage/indexeddb/resources/transaction-abort-workers.js:86
> +function timeoutTest()

This tests the change to V8WorkerContextEventListener.cpp ?
Comment 17 Joshua Bell 2012-02-23 21:21:33 PST
(In reply to comment #16)
> (From update of attachment 128558 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=128558&action=review
> 
> LGTM, FWIW
> 
> > LayoutTests/fast/js/resources/js-test-pre.js:463
> > +    return worker;
> 
> Thanks for adding this, I had to add it locally for something else.
> 
> > LayoutTests/storage/indexeddb/resources/transaction-abort-workers.js:37
> > +    evalAndLog("store = transaction.objectStore('store')");
> 
> Before this patch, none of these event handlers would be called?

Yes. Because the transaction didn't start, it would remain in the queue since an abort was never fired.

> > LayoutTests/storage/indexeddb/resources/transaction-abort-workers.js:50
> > +function recursionTest()
> 
> This still worked before this patch, right?

Yes; this test is to verify that the transaction abort logic isn't kicking in too early with the change

> 
> > LayoutTests/storage/indexeddb/resources/transaction-abort-workers.js:86
> > +function timeoutTest()
> 
> This tests the change to V8WorkerContextEventListener.cpp ?

The timeout test tests the change to ScheduledAction.cpp (which deals with setTimeout, setInterval and friends).

The V8WorkerContextEventListener.cpp change is actually tested by the createTransaction test, since that runs in response to the setVersion's transaction's "complete" event.

The V8WorkerContextErrorHandler.cpp change is tested by the errorTest.

The WorkerContextExecutionProxy.cpp change is not directly tested, since it would require a transaction to be created in the worker's "root" execution context and not in any event/error/scheduled callbacks, which I don't think is possible in IDB (since you get the initial DB handle via a callback). Ideas welcome, though.
Comment 18 Adam Klein 2012-02-24 15:07:59 PST
Looks good to me from the V8RecursionScope angle.
Comment 19 WebKit Review Bot 2012-02-24 16:27:04 PST
Comment on attachment 128558 [details]
Patch

Clearing flags on attachment: 128558

Committed r108867: <http://trac.webkit.org/changeset/108867>
Comment 20 WebKit Review Bot 2012-02-24 16:27:10 PST
All reviewed patches have been landed.  Closing bug.