-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Undocumented value replay feature within RetryableOperation presents memory leak #11393
Labels
Comments
Could you give the PR release over in #11424 a try and report back if that works for you? |
phryneas
added a commit
that referenced
this issue
Dec 20, 2023
The fix for this will be in the next Apollo Client 3.9 beta we will release. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Issue Description
RetryableOperation
, a class exclusively used withinRetryLink
, stores a private array of values that pushes each and every value emitted through theonNext
method ofRetryableOperation
, which itself is called whenever theRetryLink
receives a value throughnext
. The purpose of this value array is to replay all previously emitted values to new subscribers to the request observer returned byRetryLink
; however, such functionality is not publicly documented in articles relating toRetryLink
, nor does the commit adding said functionality (back when the code was part ofapollo-link
monorepo) mention why this replay feature was added.This feature becomes problematic when using a periodic, long-running subscription that emits values through
next
for an indefinite amount of time without completing, which causes the browser to consume more and more memory over time.A more thorough description of the issue can be found in this community post
Link to Reproduction
subscription backend: https://codesandbox.io/p/devbox/fervent-gwen-kpkwt5?file=%2F.codesandbox%2Ftasks.json%3A5%2C38
frontend subscription with retry link: https://codesandbox.io/p/sandbox/apollo-subscription-with-auth-forked-tzlw6s?file=%2Fsrc%2FAuthors.tsx
Reproduction Steps
Debug!
button in the frontend playground to initiate a breakpoint when subscription data arrivesRetryableOperation.onNext
in the call stack - navigate to this entrythis.onNext
function definition that logsthis.values.length
or something similarThe text was updated successfully, but these errors were encountered: