You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In 10.2.4 after the worker script has been fetched, there is a step labeled Closing orphan workers which asks to monitor for when the worker stops being a protected worker.
A worker is said to be a protected worker if it is an active needed worker and either it has outstanding timers, database transactions, or network connections, or its list of the worker's ports is not empty, or its WorkerGlobalScope is actually a SharedWorkerGlobalScope object (i.e., the worker is a shared worker).
If I read this correctly, this means that to be "protected" a dedicated worker has to be both an active needed worker, and to have one of the ties still tied. That sounds quite wrong as this would mean that even if a nested worker had an active MessagePort tied to another port in the main Document thread and that the owner worker got killed, the nested worker would also get killed.
I suppose the first "and" should actually be an "or".
But it's not so simple, because to not be an active needed worker1, all of the worker's owners in its owner set have to be dead. So that "and" could actually have worked too in that case, if the owner set did contain the main Document.
But searching for the keyword owner set in this document it seems that only the parent WorkerGlobalScope is ever appended to that set. It seems that there was something that was meant to happen somehow in that exact case, since the steps 3 and 4 do set a parent worker global scope variable to the WorkerGlobalScope a.k.a. owner, but nothing is ever done with it passed that point, and owner doesn't seem to be changed to anything else either.
So I guess some clarifications around that area are needed.
Footnotes
By the way there seems to be a missing "of" in the linked sentence. ↩
The text was updated successfully, but these errors were encountered:
Looks like I was completely wrong in my assumption: the nested worker is indeed killed when its parent is killed, even if it's still actively doing observable stuff.
That still leaves a few oddities to be fixed though (like the missing "of", or the unused parent worker global scope variable) but these can be handled in a PR directly I believe.
I'll thus close this issue.
What is the issue with the HTML Standard?
In 10.2.4 after the worker script has been fetched, there is a step labeled Closing orphan workers which asks to monitor for when the worker stops being a protected worker.
If I read this correctly, this means that to be "protected" a dedicated worker has to be both an active needed worker, and to have one of the ties still tied. That sounds quite wrong as this would mean that even if a nested worker had an active
MessagePort
tied to another port in the main Document thread and that the owner worker got killed, the nested worker would also get killed.I suppose the first "and" should actually be an "or".
But it's not so simple, because to not be an active needed worker1, all of the worker's owners in its owner set have to be dead. So that "and" could actually have worked too in that case, if the owner set did contain the main Document.
But searching for the keyword owner set in this document it seems that only the parent
WorkerGlobalScope
is ever appended to that set. It seems that there was something that was meant to happen somehow in that exact case, since the steps 3 and 4 do set a parent worker global scope variable to theWorkerGlobalScope
a.k.a. owner, but nothing is ever done with it passed that point, and owner doesn't seem to be changed to anything else either.So I guess some clarifications around that area are needed.
Footnotes
By the way there seems to be a missing "of" in the linked sentence. ↩
The text was updated successfully, but these errors were encountered: