Use @PreDestroy to ensure KuduClientWrapper is closed#12149
Use @PreDestroy to ensure KuduClientWrapper is closed#12149kokosing merged 1 commit intotrinodb:masterfrom
Conversation
e96ffdd to
ee793b2
Compare
plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduSecurityModule.java
Outdated
Show resolved
Hide resolved
ee793b2 to
af952dd
Compare
|
I don't suppose there's an easy way to test this? (Maybe we might just end up testing an airlift feature instead of our code which doesn't add value). |
|
@kokosing - I'm wrong about the LifeCycleManager not being required :-( Update: Resolved by moving @PreDestroy to |
358552a to
45a05d9
Compare
plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduClientSession.java
Outdated
Show resolved
Hide resolved
plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduClientWrapper.java
Outdated
Show resolved
Hide resolved
|
Some context of "why" this works (Guice and Bootstrap magic) in commit message will likely help any future developer trying to copy what you did here. (The comments in #12149 (comment) have the explanation I think). |
45a05d9 to
0bb7637
Compare
I've updated the commit message: Not 100% sure if it captures it or if it could be shorted? |
…sure Netty's ResourceLeakDetector<HashedWheelTimer> logged a warning that the timer was not being released via KuduClientWrapper. KuduClientSession now has a @PreDestroy annotated method to release the KuduClientWrapper. This is called by Airlift's LifeCycleManager due to the presence of the @PreDestroy/@PostContruct javax annotations.
hashhar
left a comment
There was a problem hiding this comment.
Thanks for tracking this down. I did verify that the KuduAsyncClient and KuduClientWrapper are being closed via debugger.
plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduClientSession.java
Outdated
Show resolved
Hide resolved
0bb7637 to
af3122f
Compare
|
Thanks for doing this @leveyja |
|
Thanks! |
Description
Netty's ResourceLeakDetector logged a warning
that the resource was not being released via KuduClientWrapper.
Fix/Improvement
Connector (Kudu)
Ensure closable resources are closed during graceful shutdown
Related issues, pull requests, and links
Documentation
(*) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
(*) No release notes entries required.
( ) Release notes entries required with the following suggested text: