Skip to content
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 #1063

Closed
pgus2024 opened this issue May 14, 2024 · 1 comment
Closed

Memory Leak #1063

pgus2024 opened this issue May 14, 2024 · 1 comment

Comments

@pgus2024
Copy link

pgus2024 commented May 14, 2024

We are getting the following exception with Pushy 0.15.4 and netty-tcnative-boringssl-static 2.0.62.Final

loglevel=ERROR logger=io.netty.util.ResourceLeakDetector LEAK: ReferenceCountedOpenSslContext.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information. Recent access records: Created at: io.netty.handler.ssl.ReferenceCountedOpenSslContext.<init>(ReferenceCountedOpenSslContext.java:261) io.netty.handler.ssl.ReferenceCountedOpenSslClientContext.<init>(ReferenceCountedOpenSslClientContext.java:68) io.netty.handler.ssl.SslContext.newClientContextInternal(SslContext.java:843) io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:615) com.eatthepath.pushy.apns.ApnsClientBuilder.build(ApnsClientBuilder.java:619)

Context: We operate several applications that utilize a shared platform for delivering notifications. Currently, we store instances of ApnsClient to the certificate information, in a Google cache with an expiry set to one hour. Are there any adjustments we should consider making to address this issue?

@jchambers
Copy link
Owner

The problem is almost certainly that you are not calling ApnsClient#close() when clients get evicted from your cache.

To quote the ApnsClient documentation:

APNs clients are intended to be long-lived, persistent resources. They are also inherently thread-safe and can be shared across many threads in a complex application. Callers must shut them down via the close() method when they are no longer needed (i.e. when shutting down the entire application). If an event loop group was specified at construction time, callers should shut down that event loop group when all clients using that group have been disconnected.

I am not deeply familiar with Guava caches (which is what I presume you mean by "Google cache"), but it sounds like you may need a removal listener.

I am confident there is not a bug here, and so will close this issue.

@jchambers jchambers closed this as not planned Won't fix, can't repro, duplicate, stale May 17, 2024
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

No branches or pull requests

2 participants