-
-
Notifications
You must be signed in to change notification settings - Fork 522
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
Memory leak when actor metrics are enabled #745
Comments
Also, it's not clear to me how that metric ( |
I'm keen to help with this issue. Any hint on how to fix the leak and correctly implement the mailbox metric? |
Thanks for the detailed report. |
It should be due to the registered callback for each actor, which keeps references to its mailbox and context via the closure. So changing the callback logic should also fix the leak. I'm thinking about registering a single callback in the OpenTelemetry Thanks for the response. |
Describe the bug
Enabling actor metrics:
causes a memory leak when actors are stopped.
To Reproduce
Run the following main:
A few GB of RAM are retained even though the actors are stopped immediately after sending the data message.
By replacing
with
the memory leak disappears.
Expected behavior
The memory is released when the actors are stopped.
Additional context
In
props.go
the default spawner contains this code:Specifically the closure
func(goCtx context.Context)
capturesmb
andctx
, and is not unregistered after the actor is stopped.This seems to be the root cause of the memory leak.
The text was updated successfully, but these errors were encountered: