[whatwg] Worker lifecycle

Maciej Stachowiak mjs at apple.com
Thu May 28 19:47:37 PDT 2009


On May 28, 2009, at 5:17 PM, Ian Hickson wrote:

> On Thu, 28 May 2009, Maciej Stachowiak wrote:
>> On May 28, 2009, at 1:08 PM, Ian Hickson wrote:
>>> On Thu, 28 May 2009, Maciej Stachowiak wrote:
>>>
>>>> If so, that seems like it could create unbounded memory leaks in
>>>> long-running Web applications that use MessagePorts, even if all
>>>> references to both endpoints of the MessageChannel are dropped.  
>>>> That
>>>> seems unacceptable to me, unless I misunderstood.
>>>
>>> The requirement is actually indistinguishable from the UA using the
>>> other alternative and just having a really slow garbage collector  
>>> that
>>> only runs at page-closing time.
>>
>> So it's exactly equivalent to the old requirement, except the spec  
>> now
>> specifically points out that you can just leak forever instead. I  
>> don't
>> think that addresses the original concern at all.
>
> I've tweaked the text some to make it clear that once the port is not
> entangled, it doesn't continue being protected in this way.

The new text seems to be this:

"When a MessagePort object is entangled, user agents must either act  
as if the object has a strong reference to its entangledMessagePort  
object, or as if the MessagePort object's owner has a strong reference  
to the MessagePort object"

It seems to me this allows the following case: two message ports A and  
B are entangled. A is treated as having a strong reference to B, but  
is not treated as if its owner has a strong reference to it. However,  
B is not treated as having a strong reference to A, but is treated as  
if its owner has a strong reference to it. Is that intended? I think  
this behavior would be practically implementable and quite useful in  
many cases, even though it is asymmetric. But I am not sure if the  
text intended to allow it.

Regards,
Maciej



More information about the whatwg mailing list