You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Intended outcome: InMemoryCache is garbage collected from memory after client stops.
This is similar to #7274, but I believe this is a separate issue. Similarly to the linked issue, InMemoryCache never gets evicted after apollo client has finished running during SSR. The client is stopped with apolloClient.stop() at the end. The new code introduced as a fix in #7279 is executed, but it doesn't fix the issue.
Actual outcome: InMemoryCache should be evicted from memory after running.
The text was updated successfully, but these errors were encountered:
kkgrigas
changed the title
Reactive variables prevent cache from being evicted
Reactive variables prevent cache from being garbage collected
Jan 27, 2021
@kkgrigas Do these InMemoryCache objects still have anything in their cache.watches sets? I ask because #7279 will only help if all watches are cancelled before the cache is discarded.
It doesn't look like it is relevant. I tried SSR'ing different pages which contain different queries, with new InMemoryCache created on each request. Most of them had watches empty or emptied after rendering, one of them didn't.
@kkgrigas This should be fixed in @apollo/[email protected] (published earlier today), and we now have a regression test that should prevent this kind of leak from happening in the future. Thanks again for the excellent reproduction!
Intended outcome:
InMemoryCache
is garbage collected from memory after client stops.This is similar to #7274, but I believe this is a separate issue. Similarly to the linked issue,
InMemoryCache
never gets evicted after apollo client has finished running during SSR. The client is stopped withapolloClient.stop()
at the end. The new code introduced as a fix in #7279 is executed, but it doesn't fix the issue.Actual outcome:
InMemoryCache
should be evicted from memory after running.How to reproduce the issue:
I've made a minimal repo in https://github.com/kkgrigas/apollo-client-sample
Run it, and then make many requests to started server (i.e. using
siege
)Versions
System:
OS: macOS 11.1
Binaries:
Node: 14.12.0 - /usr/local/bin/node
Yarn: 1.22.10 - ~/projects/web/node_modules/.bin/yarn
npm: 6.14.8 - /usr/local/bin/npm
Browsers:
Chrome: 88.0.4324.96
Edge: 88.0.705.53
Firefox: 85.0
Safari: 14.0.2
npmPackages:
@apollo/client: 3.3.7 => 3.3.7
apollo: 2.31.1 => 2.31.1
apollo-link-logger: 2.0.0 => 2.0.0
apollo-link-persisted-queries: 0.2.2 => 0.2.2
apollo-upload-client: 14.1.3 => 14.1.3
The text was updated successfully, but these errors were encountered: