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
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Epics operators subscriptions create several QueueAction instances, which are held in OperatorSubscriber's _teardowns array and never freed. Worse, these objects's work member can hold contexts from operators, which often include pretty heavy objects, like state, which quickly fill up memory on large applications.
On our real life application, while stress-testing it, we've seen Node process dump core with 8GB+ memory usage (while the base memory usage lays below 40MB). We thought some of the native libraries there were causing the leak, but we managed to create a standalone repro also demonstrating it.
If the current behavior is a bug, please provide the steps to reproduce and a minimal demo of the problem using JSBin, StackBlitz, or similar.
I've created a standalone NodeJS app, which can be debugged with Chrome DevTools Inspector: https://github.com/andrevmatos/redux-observable-leak-repro
As is stated in README, one can reproduce with:
yarn
yarn build
node --inspect-brk index.js
Then open Chrome/Chromium in chrome://inspect , click on the waiting instance, press F8 to run the code, then go to Memory tab and take a Heap snapshot to see the leaked objects.
Example (notice 150k+ QueueActions):
What is the expected behavior?
Even if the range is created synchronously, as soon as the actions are dispatched and handled, the objects, variables and contexts should be freed. Notice the repro keep only the latest action payload (at most ~50kb) in the state, the repro does NOT keep any explicit reference to any action, state or payload beyond the latest (as a standard redux example), and no explicit subscription is made, therefore everything created during initial processing should be garbage-collected.
Some things I've tried:
replacing the range observable with lazy generator or mergeMap to async/Promise instead of sync array => bug still occurs
manually editing redux-observable/dist/cjs/createEpicMiddleware.js and removing all usage of uniqueQueueScheduler, subscribeOn and observeOn => bug does not occur
Which versions of redux-observable, and which browser and OS are affected by this issue? Did this work in previous versions of redux-observable?
NodeJS 14.x
yarn 1.x
rxjs@7.3
redux-observable@2.0.0
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Epics operators subscriptions create several
QueueAction
instances, which are held inOperatorSubscriber
's_teardowns
array and never freed. Worse, these objects'swork
member can holdcontext
s from operators, which often include pretty heavy objects, likestate
, which quickly fill up memory on large applications.On our real life application, while stress-testing it, we've seen Node process dump core with 8GB+ memory usage (while the base memory usage lays below 40MB). We thought some of the native libraries there were causing the leak, but we managed to create a standalone repro also demonstrating it.
If the current behavior is a bug, please provide the steps to reproduce and a minimal demo of the problem using JSBin, StackBlitz, or similar.
I've created a standalone NodeJS app, which can be debugged with Chrome DevTools Inspector:
https://github.com/andrevmatos/redux-observable-leak-repro
As is stated in README, one can reproduce with:
Then open Chrome/Chromium in
chrome://inspect
, click on the waiting instance, press F8 to run the code, then go toMemory
tab and take aHeap snapshot
to see the leaked objects.Example (notice 150k+
QueueAction
s):What is the expected behavior?
Even if the
range
is created synchronously, as soon as the actions are dispatched and handled, the objects, variables and contexts should be freed. Notice the repro keep only the latest action payload (at most ~50kb) in the state, the repro does NOT keep any explicit reference to any action, state or payload beyond the latest (as a standard redux example), and no explicit subscription is made, therefore everything created during initial processing should be garbage-collected.Some things I've tried:
range
observable with lazy generator ormergeMap
to async/Promise instead of sync array => bug still occursredux-observable/dist/cjs/createEpicMiddleware.js
and removing all usage ofuniqueQueueScheduler
,subscribeOn
andobserveOn
=> bug does not occurWhich versions of redux-observable, and which browser and OS are affected by this issue? Did this work in previous versions of redux-observable?
NodeJS 14.x
yarn 1.x
rxjs@7.3
redux-observable@2.0.0
The text was updated successfully, but these errors were encountered: