-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix(server-runtime: fix request signal not aborting after request is garbage collected #10030
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
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 |
Thank you for opening this pull request, and our apologies we haven't gotten around to it yet! With the release of React Router v7 we are sun-setting continued development/maintenance on Remix v2. If you have not already upgraded to React Router v7, we recommend you do so. We've tried to make the upgrade process as smooth as possible with our Future Flags. We are now in the process of cleaning up outdated issues and pull requests to improve the overall hygiene of our repositories. We plan to continue to address 2 types of issues in Remix v2:
If you believe this pull request meets one of those criteria, please respond or create a new pull request so it pops up on our radar (since github notifications may get lost in the noise 😕). For all other issues/changes, ongoing maintenance will be happening in React Router v7, so:
If you have any questions you can always reach out on Discord. Thanks again for providing feedback and helping us make our framework even better! |
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