Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3cb928bc8c15b75620a673dd9e08ba2d54e3c94a
      
https://github.com/WebKit/WebKit/commit/3cb928bc8c15b75620a673dd9e08ba2d54e3c94a
  Author: Youenn Fablet <[email protected]>
  Date:   2023-07-30 (Sun, 30 Jul 2023)

  Changed paths:
    M Source/WebCore/workers/service/server/SWServer.cpp
    M Source/WebCore/workers/service/server/SWServerJobQueue.cpp

  Log Message:
  -----------
  SWServerJobQueue::scriptContextStarted might have a null registration
https://bugs.webkit.org/show_bug.cgi?id=259591
rdar://112997411

Reviewed by Alex Christensen.

>From logs, it appears SWServerJobQueue::scriptContextStarted might have a 
>nullptr registration.
One possibility is the following:
- A main thread service worker page is created.
- The service worker is being installed (in main thread) and succeeds. This 
triggers a callOnMainThread to execute the callback that will notify network 
process to continue its processing
- Before the callback is executed, the service worker page is closed and the 
network process is notified about this.
- The network process removes the registration from its map in 
SWServer::unregisterServiceWorkerClient.
- The network process processes the message to continue installing the service 
worker and continue with the current job.

To prevent this, we are now making sure to cancel the job of a preinstalling 
service worker whose registration is removed in 
SWServer::unregisterServiceWorkerClient.
Since this is a speculative fix, we transform the ASSERT(registration) in an 
if+ASSERT.
We add logging to make sure to keep track of this, in case this might trigger 
job queue hangs.

* Source/WebCore/workers/service/server/SWServer.cpp:
(WebCore::SWServer::unregisterServiceWorkerClient):
* Source/WebCore/workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::scriptContextFailedToStart):
(WebCore::SWServerJobQueue::scriptContextStarted):

Canonical link: https://commits.webkit.org/266419@main


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to