[Webkit-unassigned] [Bug 31698] New: MessagePorts always look remotely entangled even when closed.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 19 18:16:14 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31698

           Summary: MessagePorts always look remotely entangled even when
                    closed.
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore Misc.
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: atwilson at chromium.org


We use the following idiom to see if a port is remotely entangled:

port->isEntangled() && !port->locallyEntangledPort()

The problem is that isEntangled() returns true even when a port is closed, so a
worker that is closed looks like it is remotely entangled.

On JSC-based platforms (e.g. Safari), the port will be closed/freed when the
parent context exits. Since a remotely entangled MessagePort is sufficient to
keep a worker alive, a fire-and-forget worker that just contains this code:

var channel = new MessageChannel();
channel.port1.close();

...will stay alive until the parent document shuts down.

On Chromium, ports leak until the parent *process* closes, thanks to this line
in V8GCController.cpp:

        if (port1->isEntangled() && !port2)
            wrapper.ClearWeak();

We need a better way to figure out if a port is remotely entangled - one option
would be to have isEntangled() return false if the worker has been closed.
Right now, the code is a little fuzzy about the distinction between a
disentangled/closed port and a *cloned* port - we'll need to clear that up as
well as part of this fix (for example, it's OK to pass a disentangled port to
postMessage(), but it's not OK to pass a cloned port to postMessage()).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list