-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
worker: prevent event loop starvation through MessagePorts #29315
worker: prevent event loop starvation through MessagePorts #29315
Conversation
d69503b
to
6db2d79
Compare
Actually, it looks like this also makes some trouble on Windows. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking with "request changes" so no one accidentally lands this before the Windows tests are passing. Feel free to dismiss this request-for-changes once the tests are passing.
Limit the number of messages processed without interruption on a given `MessagePort` to prevent event loop starvation, but still make sure that all messages are emitted that were already in the queue when emitting began. This aligns the behaviour better with the web. Refs: nodejs#28030
6db2d79
to
fab5d00
Compare
Turns out the timeouts on Windows were happening because the way this change modified behaviour actually impacted performance on Windows noticeably – in CI, that is. I couldn’t reproduce any issues locally. I’ve rebased this PR and modified it so that at least 1k messages are processed in one batch, which still meets the requirements of not starving the event loop and makes our Windows CI happy. (I’ll kick off CI but linuxone is down currently so it won’t pass at least because of that.) |
Not sure who is aware and who isn't, so posting this: According to nodejs/build#1909 (comment), the LinuxONE maintenance outage should be over in less than 5 hours. I imagine if you leave the CI running, it will eventually kick off and (hopefully) pass. |
Landed in b34f05e |
Limit the number of messages processed without interruption on a given `MessagePort` to prevent event loop starvation, but still make sure that all messages are emitted that were already in the queue when emitting began. This aligns the behaviour better with the web. Refs: #28030 PR-URL: #29315 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Limit the number of messages processed without interruption on a given `MessagePort` to prevent event loop starvation, but still make sure that all messages are emitted that were already in the queue when emitting began. This aligns the behaviour better with the web. Refs: #28030 PR-URL: #29315 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
Limit the number of messages processed without interruption on a given `MessagePort` to prevent event loop starvation, but still make sure that all messages are emitted that were already in the queue when emitting began. This aligns the behaviour better with the web. Refs: #28030 PR-URL: #29315 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
This is a re-do of #28030 that also respects another web platform test (that messages that are queued before a .close() call are also emitted).
Limit the number of messages processed without interruption on a
given
MessagePort
to prevent event loop starvation, but stillmake sure that all messages are emitted that were already in the
queue when emitting began.
This aligns the behaviour better with the web.
Refs: #28030
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes