RESOLVED FIXED 193747
Refactor ServiceWorkerJob management by ServiceWorkerContainer to make it more memory safe
https://bugs.webkit.org/show_bug.cgi?id=193747
Summary Refactor ServiceWorkerJob management by ServiceWorkerContainer to make it mor...
youenn fablet
Reported 2019-01-23 16:28:26 PST
This should fix some memory ref cycles and would also ensure that network process does not wait until the end of day for the job to be finished.
Attachments
Patch (1.58 KB, patch)
2019-01-23 16:31 PST, youenn fablet
no flags
Patch (25.85 KB, patch)
2019-01-25 12:38 PST, youenn fablet
no flags
Patch (27.81 KB, patch)
2019-01-25 15:57 PST, youenn fablet
no flags
Patch (29.10 KB, patch)
2019-01-28 11:19 PST, youenn fablet
no flags
Patch for landing (29.15 KB, patch)
2019-01-30 12:01 PST, youenn fablet
no flags
youenn fablet
Comment 1 2019-01-23 16:28:49 PST
youenn fablet
Comment 2 2019-01-23 16:31:06 PST
Alex Christensen
Comment 3 2019-01-24 09:08:55 PST
Comment on attachment 359971 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359971&action=review > Source/WebCore/ChangeLog:11 > + Covered by existing tests. Why were there no changes to existing tests then?
David Kilzer (:ddkilzer)
Comment 4 2019-01-24 09:31:35 PST
Comment on attachment 359971 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=359971&action=review r=me >> Source/WebCore/ChangeLog:11 >> + Covered by existing tests. > > Why were there no changes to existing tests then? To reproduce the leak, you must run WK2 tests with --leaks flag and have it check the com.apple.WebKit.WebContent.Development process for leaks. (In other words, this would be caught by a leaks bot if we had a WK2 leaks bot.) There is an uncommitted patch to do that, but I haven't had time to clean it up for review. See Bug 193772.
youenn fablet
Comment 5 2019-01-25 11:14:23 PST
(In reply to youenn fablet from comment #0) > This should fix some memory ref cycles and would also ensure that network > process does not wait until the end of day for the job to be finished. Hum, patch does not fix a pre-existing setPendingActivity/unsetPendingActivity issue... Let's do a more complete patch.
youenn fablet
Comment 6 2019-01-25 12:38:34 PST
youenn fablet
Comment 7 2019-01-25 15:57:03 PST
youenn fablet
Comment 8 2019-01-28 11:19:45 PST
youenn fablet
Comment 9 2019-01-30 11:00:20 PST
Ping review
Chris Dumez
Comment 10 2019-01-30 11:46:16 PST
Comment on attachment 360360 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=360360&action=review r=me with comments > Source/WebCore/ChangeLog:14 > + Before the patch, the jobs map was never cleared, which is creating a ref cycle whenever a job is not succesfull. typo: succesfull > Source/WebCore/ChangeLog:16 > + Before the patch, unsetPendingActivity was only called for successful jobs finishing. "successful", there it is. > Source/WebCore/workers/service/ServiceWorkerContainer.h:125 > + RefPtr<PendingActivity<ServiceWorkerContainer>> pendingActivity; Can this be a Ref<> ? > Source/WebCore/workers/service/ServiceWorkerJob.h:50 > +class ServiceWorkerJob : public WorkerScriptLoaderClient { WTF_MAKE_FAST_ALLOCATED; since you're dropping RefCounted.
youenn fablet
Comment 11 2019-01-30 11:57:27 PST
> > Source/WebCore/workers/service/ServiceWorkerContainer.h:125 > > + RefPtr<PendingActivity<ServiceWorkerContainer>> pendingActivity; > > Can this be a Ref<> ? This would need to add type traits for empty value. This seemed like overkill to me since we are never accessing the pendingActivity. I guess we could make it private or make OngoingJob a class if we want to. > > Source/WebCore/workers/service/ServiceWorkerJob.h:50 > > +class ServiceWorkerJob : public WorkerScriptLoaderClient { > > WTF_MAKE_FAST_ALLOCATED; since you're dropping RefCounted. OK
youenn fablet
Comment 12 2019-01-30 12:01:12 PST
Created attachment 360602 [details] Patch for landing
WebKit Commit Bot
Comment 13 2019-01-30 13:00:36 PST
Comment on attachment 360602 [details] Patch for landing Clearing flags on attachment: 360602 Committed r240727: <https://trac.webkit.org/changeset/240727>
WebKit Commit Bot
Comment 14 2019-01-30 13:00:37 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.