fix(server-runtime: fix request signal not aborting after request is garbage collected #10030
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #9976 (comment)
Update (Sep 26)
In development, it appears that globals aren't being automatically installed and
Request
with node ends up coming fromundici
.undici
currently has a bug where parent signals aren't properly followed: nodejs/node#55428In production, globals are installed and
Request
comes fromweb-fetch
. This version ofRequest
does not have the above issue.It seems like globals should be installed in development as well? Manually invoking
installGlobals()
changes theRequest
object and solves this issue.Original:
Testing Strategy:
Add
remix-utils
and the following routes. Start the dev server and open/time
in a bunch of different tabs. Refresh the tabs randomly, close them, create new ones, etc, and eventually you'll trigger the GC in the right way whereSSE connection closed ${number of open conns}
will be logged to the console with the number of open connections being greater than the number of open tabs. A good way to see if you've triggered this is just to close all of them and see if the logged connection count is greater than 0.routes/sse.time.ts
routes/time.tsx