-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SWServerJobQueue::scriptContextStarted might have a null registration #16161
SWServerJobQueue::scriptContextStarted might have a null registration #16161
Conversation
EWS run on previous version of this PR (hash 22dbae9) |
@@ -157,7 +157,10 @@ void SWServerJobQueue::scriptContextFailedToStart(const ServiceWorkerJobDataIden | |||
|
|||
// If an uncaught runtime script error occurs during the above step, then: | |||
auto* registration = m_server.getRegistration(m_registrationKey); | |||
RELEASE_LOG_ERROR(ServiceWorker, "SWServerJobQueue::scriptContextFailedToStart registration is null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this log go into the if (!registration)?
@@ -180,7 +183,10 @@ void SWServerJobQueue::scriptContextStarted(const ServiceWorkerJobDataIdentifier | |||
return; | |||
|
|||
auto* registration = m_server.getRegistration(m_registrationKey); | |||
RELEASE_LOG_ERROR(ServiceWorker, "SWServerJobQueue::scriptContextStarted registration is null"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
ASSERT(registration); | ||
if (!registration) | ||
return; | ||
|
||
ASSERT(registration->preInstallationWorker()); | ||
registration->preInstallationWorker()->terminate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems worth null checking this too, while we're at it.
22dbae9
to
84644fd
Compare
EWS run on current version of this PR (hash 84644fd) |
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
84644fd
to
3cb928b
Compare
Committed 266419@main (3cb928b): https://commits.webkit.org/266419@main Reviewed commits have been landed. Closing PR #16161 and removing active labels. |
3cb928b
84644fd