Skip to content

Fix for (slow) memory leak in ClientState#1258

Merged
ignasi35 merged 2 commits intoakka:masterfrom
raboof:fix-leak-1257
Feb 8, 2021
Merged

Fix for (slow) memory leak in ClientState#1258
ignasi35 merged 2 commits intoakka:masterfrom
raboof:fix-leak-1257

Conversation

@raboof
Copy link
Copy Markdown
Contributor

@raboof raboof commented Feb 5, 2021

ClientState registered a whenTerminated callback to close the client when
the actor system terminates. However, this whenTerminated callback is never
removed, meaning it will hold on to the ClientState, causing a (small)
memory leak each time a client is instantiated.

This PR is intended to fix the problem, but doesn't work due to what
looks like an extension initialization deadlock. That reminds of
akka/akka-core#28046 but it also seems present when I
switch to master, which is on Akka 2.6

Refs #1257

Copy link
Copy Markdown
Contributor

@johanandren johanandren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lookin good, left some nitpicking as a weekend gift.

Comment thread runtime/src/main/scala/akka/grpc/scaladsl/Grpc.scala Outdated
Comment thread runtime/src/main/scala/akka/grpc/scaladsl/Grpc.scala Outdated
Comment thread runtime/src/main/scala/akka/grpc/scaladsl/Grpc.scala Outdated
@raboof raboof force-pushed the fix-leak-1257 branch 2 times, most recently from 2362626 to 4439127 Compare February 8, 2021 11:45
`ClientState` registered a `whenTerminated` callback to close the client when
the actor system terminates. However, this `whenTerminated` callback is never
removed, meaning it will hold on to the `ClientState`, causing a (small)
memory leak each time a client is instantiated.

akka#1257
Copy link
Copy Markdown
Contributor

@ignasi35 ignasi35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@raboof raboof marked this pull request as ready for review February 8, 2021 12:48
@ignasi35
Copy link
Copy Markdown
Contributor

ignasi35 commented Feb 8, 2021

Hi @raboof, the branch for this PR starts on the commit tagged 1.0.2. Did you want to release a 1.0.3 with this fix?

@raboof
Copy link
Copy Markdown
Contributor Author

raboof commented Feb 8, 2021

Hi @raboof, the branch for this PR starts on the commit tagged 1.0.2. Did you want to release a 1.0.3 with this fix?

No, I just started there because that was the version we encountered the leak with. This way we could merge it into a 1.0.x branch, but I don't see a strong reason to have such a branch.

@ignasi35
Copy link
Copy Markdown
Contributor

ignasi35 commented Feb 8, 2021

workflow issue is unrelated to this PR (See #1259 )

@ignasi35 ignasi35 merged commit bb4e406 into akka:master Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants