Bug 231285 - Add support for processing push events without service worker clients
Summary: Add support for processing push events without service worker clients
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-06 03:15 PDT by youenn fablet
Modified: 2021-10-08 03:03 PDT (History)
13 users (show)

See Also:


Attachments
Patch (24.64 KB, patch)
2021-10-06 04:00 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (11.21 KB, patch)
2021-10-06 06:38 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (26.59 KB, patch)
2021-10-06 06:59 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch (26.59 KB, patch)
2021-10-06 08:32 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (26.25 KB, patch)
2021-10-08 00:48 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2021-10-06 03:15:38 PDT
Add support for processing push events without service worker clients
Comment 1 youenn fablet 2021-10-06 04:00:28 PDT
Created attachment 440351 [details]
Patch
Comment 2 youenn fablet 2021-10-06 06:38:58 PDT
Created attachment 440359 [details]
Patch
Comment 3 youenn fablet 2021-10-06 06:59:29 PDT
Created attachment 440361 [details]
Patch
Comment 4 youenn fablet 2021-10-06 08:32:56 PDT
Created attachment 440372 [details]
Patch
Comment 5 Chris Dumez 2021-10-07 07:16:29 PDT
Comment on attachment 440372 [details]
Patch

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

> Source/WebCore/workers/service/server/SWServer.cpp:1218
> +            terminateWorkerTimer->startOneShot(weakThis && weakThis->m_isProcessTerminationDelayEnabled ? defaultTerminationDelay : 1_s);

Does this mean that we have one second to:
1. IPC the SW process
2. Dispatch to the SW thread
3. Dispatch and handle the push event in JS
4. Dispatch back to the main thread
5. IPC back to the network process

If so, doesn't it seem a bit low? Seems like this could cause flakiness on some slower / overloaded machines.

I think our UIProcess responsiveness timer uses 3 seconds and even then, is only enabled on release builds (No debug builds, no ASAN, not under debugger).
Comment 6 youenn fablet 2021-10-07 08:17:21 PDT
(In reply to Chris Dumez from comment #5)
> Comment on attachment 440372 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=440372&action=review
> 
> > Source/WebCore/workers/service/server/SWServer.cpp:1218
> > +            terminateWorkerTimer->startOneShot(weakThis && weakThis->m_isProcessTerminationDelayEnabled ? defaultTerminationDelay : 1_s);
> 
> Does this mean that we have one second to:
> 1. IPC the SW process
> 2. Dispatch to the SW thread
> 3. Dispatch and handle the push event in JS
> 4. Dispatch back to the main thread
> 5. IPC back to the network process
> 
> If so, doesn't it seem a bit low? Seems like this could cause flakiness on
> some slower / overloaded machines.

Maybe, this is for testing, and this should only kick in for API tests since otherwise we will have a service worker client.
Also, the only test is actually trying to trigger the timeout, so even in case we are slow and it takes more than 1 second, we should be good for that particular test.

I can increase it to 3 seconds, but then the test will run for longer.
Let's try it
Comment 7 youenn fablet 2021-10-08 00:48:09 PDT
Created attachment 440581 [details]
Patch for landing
Comment 8 youenn fablet 2021-10-08 00:48:32 PDT
Went with 2 seconds for now.
Comment 9 EWS 2021-10-08 03:02:57 PDT
Committed r283796 (242689@main): <https://commits.webkit.org/242689@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 440581 [details].
Comment 10 Radar WebKit Bug Importer 2021-10-08 03:03:17 PDT
<rdar://problem/84020871>