WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
193184
MessagePort is unexpectedly GC'ed after activity absence
https://bugs.webkit.org/show_bug.cgi?id=193184
Summary
MessagePort is unexpectedly GC'ed after activity absence
Yoshiaki Jitsukawa
Reported
2019-01-06 18:26:38 PST
MessagePort is unexpectedly GC'ed after several GC if there'no activity around the MessagePort, though the MessagePort may be used afterwards.
Attachments
Patch (test only)
(4.03 KB, patch)
2019-01-06 18:43 PST
,
Yoshiaki Jitsukawa
ews-watchlist
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews122 for ios-simulator-wk2
(2.41 MB, application/zip)
2019-01-06 20:37 PST
,
EWS Watchlist
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Yoshiaki Jitsukawa
Comment 1
2019-01-06 18:43:01 PST
Created
attachment 358473
[details]
Patch (test only)
Yoshiaki Jitsukawa
Comment 2
2019-01-06 18:53:54 PST
Attachment 358473
[details]
is a test for reproduction. The main frame generates two MessagePorts port1 and port2 from a MessageChannel. port2 is passed to the iframe and bound to a XMLHttpRequest. <main frame> port1 <iframe> port2 <- xhr XHR gets a response after one second and then let port2 post a message to port1. However port1 is GC'ed after three times GC and port1 cannot receive the message. (Running GC two times was OK.)
Yoshiaki Jitsukawa
Comment 3
2019-01-06 18:58:58 PST
I suspect this but not sure.
Bug 181910
- Make garbage collection of MessagePort objects be asynchronous
EWS Watchlist
Comment 4
2019-01-06 20:37:26 PST
Comment on
attachment 358473
[details]
Patch (test only)
Attachment 358473
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
https://webkit-queues.webkit.org/results/10653761
New failing tests: http/tests/messaging/messageport-gc-after-xhr.html
EWS Watchlist
Comment 5
2019-01-06 20:37:27 PST
Created
attachment 358477
[details]
Archive of layout-test-results from ews122 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews122 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.6
Radar WebKit Bug Importer
Comment 6
2019-08-08 14:08:05 PDT
<
rdar://problem/54095480
>
Alexey Proskuryakov
Comment 7
2022-11-02 13:03:38 PDT
***
Bug 247372
has been marked as a duplicate of this bug. ***
Geoffrey Garen
Comment 8
2022-11-02 14:31:19 PDT
It looks like
Bug 181910
was a partial implementation that, by design, allowed a MessagePort to be GC'd after receiving its first message. I guess that's consistent with the observation in this test case, that the MessagePort is GC'd after receiving its first message. It seems like the behavior we want is that a MessagePort should be ineligible for GC (hasPendingActivity() == true) until (a) it is closed OR (b) its ScriptExecutionContext is torn down OR (c) every connected MessagePort's ScriptExecutionContext is torn down.
Chris Dumez
Comment 9
2022-11-03 12:48:31 PDT
MessagePort garbage collection is specified here: -
https://html.spec.whatwg.org/multipage/web-messaging.html#ports-and-garbage-collection
I can look at aligning with the spec.
Chris Dumez
Comment 10
2022-11-03 13:58:57 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/6099
youenn fablet
Comment 11
2022-11-04 09:36:59 PDT
This might explain
https://github.com/GoogleChromeLabs/comlink/issues/600
and
rdar://99145178
EWS
Comment 12
2022-11-04 15:49:27 PDT
Committed
256342@main
(a4790ba92ba7): <
https://commits.webkit.org/256342@main
> Reviewed commits have been landed. Closing PR #6099 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug