Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upopen.spotify.com panics with 'post_messageport_msg called on an unknown port' #24810
Comments
|
Inside an animation frame callback. I wonder if this is similar to #24591 |
|
Can this be reproduced by running the following script(I'm currently building another branch)? <script>
var chan = new MessageChannel();
window.addEventListener("unload", () => {
window.requestAnimationFrame(() => {
chan.port1.postMessage("Test");
});
});
window.location.assign("about:blank");
</script> |
|
Ok I don't think it's related to #24591, because it still happens on a branch that fixes that problem. I ran the above script on that branch too, and there were no problems, but that seems to be unrelated. |
|
So what's happening if the port is Gc'ed, although it has been started before(so an event-handler has been set on it). It's hard to tell what is exactly happening without looking at the code. I would say a port to which an event-handler as been set should not be GC'ed, but it's hard to tell exactly why it is GC'ed. It's not normally GC'ed in such a case, otherwise all tests would fail. There doesn't seem to be any navigation going-on, or a transfer of the port. The only notable thing is the animation frame callback. Also to be clear, the port that is GC'ed is the one entangled with the one on which So what happens is:
So if we don't remove the port at 2, we avoid the panic, however the message is not going to be received either. So the issues is really that the first port is GC'ed quite early it seems. In any case, it's probably a good idea to not remove the port just because the entangled one has been GC'ed, since the JS could still keep a reference to it and use it(or we should remove the panics upon use). However I don't think the messages that are sent are intended to be lost, so the why of the GC of the entangled is still an open question. |
|
Ah, so I came across something similar when deciding how i would implement the webxr Firefox has a special |
[WIP Leak message ports in Dom, until they are closed <!-- Please describe your changes on the following line: --> FIX #25461 FIX #24810 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
[WIP Leak message ports in Dom, until they are closed <!-- Please describe your changes on the following line: --> FIX #25461 FIX #24810 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
[WIP Leak message ports in Dom, until they are closed <!-- Please describe your changes on the following line: --> FIX #25461 FIX #24810 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Leak message ports in Dom, until they are closed <!-- Please describe your changes on the following line: --> FIX #25461 FIX #24810 FIX #24488 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Leak message ports in Dom, until they are closed <!-- Please describe your changes on the following line: --> FIX #25461 FIX #24810 FIX #24488 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
https://open.spotify.com