-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Dynamic Scope access causes a memory leak #3440
Labels
bug
Something isn't working
Comments
mikearnaldi
added a commit
that referenced
this issue
Aug 11, 2024
mikearnaldi
added a commit
that referenced
this issue
Aug 11, 2024
tim-smart
pushed a commit
that referenced
this issue
Aug 14, 2024
tim-smart
pushed a commit
that referenced
this issue
Aug 14, 2024
dilame
pushed a commit
to dilame/effect
that referenced
this issue
Aug 22, 2024
tim-smart
pushed a commit
that referenced
this issue
Aug 30, 2024
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Effect is running?
3.x
What steps can reproduce the bug?
The following code ends up creating a memory leak:
The reason is that
all
usesforEach
andforEach
dynamically accessesScope
in order to execute finalizers according to the strategy specified inconcurrency
. It all sounds like a nice feature but to do that we need to create a child scope that cannot close until the parent closes, and doing this repeatedly ends up adding an unbounded amount of finalizers into the parentScope
which may be created further up (and in theory may never close).This bug was discovered by the JUCR folks and was also found in ZIO, the choice of action for ZIO has been to remove the feature altogether, I think we can do better and allow the feature with a specific flag since this only materialise when the
forEach
itself is repeated & when you have a parentScope
that never closes.What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: