-
Notifications
You must be signed in to change notification settings - Fork 560
Fix memory leak in Supervisor
internal state
#4500
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
base: series/3.6.x
Are you sure you want to change the base?
Conversation
apply[F](false) | ||
|
||
private sealed abstract class State[F[_]] { | ||
private[std] sealed abstract class State[F[_]] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes in Supervisor
are just to make it testable (its internal state inspectable).
|
||
case None => (fa, fin) => F.start(fa.guarantee(fin)) | ||
case None => { (fa, fin) => | ||
F.start(fa).flatMap { fib => F.start(fib.join.guarantee(fin)).as(fib) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual fix.
(I believe the other case
is already correct, because cancel
joins the underlying fiber.)
Should fix issue #4490.
Reproducing that issue with the repro in the description there:
With this PR:
This issue also adds an (ugly) unittest, which inspects the internal state of the
Supervisor
. We could remove that, if we're satisfied with the fix, but I think it's useful to have it.(Draft, because the test is racy, so I'm waiting for any possible CI failures.)