-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix(server-runtime: fix request signal not aborting after request is garbage collected #10030
base: dev
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: aaab009 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Hi @jvaill, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
1a9aadc
to
7223636
Compare
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
6370547
to
a4b85fc
Compare
a4b85fc
to
aaab009
Compare
Fyi - the underlying problem appears to be a bug in undici: |
FWIW we are deprecating the For now, it looks like there is some traction on the |
@brophdawg11 Another update on this - (IIRC, been a few weeks) at first I thought this was going to fix signals in production, but it seems like that's an entirely different bug altogether. When signals are working (i.e., in development), this fixes signals sporadically not being aborted due to GC. I gave up on getting signals to work and ended up switching from SSE to websockets 😅 |
Did you implement your own server with Express and Remix? Or what did you use? Considering to do the same tbh |
Is it correct to say that SSEs are not working right now in Remix? I have been trying the last few days to find a workaround to this but been unable. We are starting up a new project and this is a curveball. It would be sad to go another route than Remix! These issues are also reported here: |
@brophdawg11 Have you considered the path forward regarding this issue? Is this a waiting thing, or something you can/will patch? |
I ended up adding a separate service to handle websockets. Basically, it uses |
Closes: #9976 (comment)Edit: There appears to be a different bug with signals not working at all in production.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