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

Fix file handle leaks in Pinot Driver (apache#12263) #12356

Merged
merged 4 commits into from
Feb 13, 2024

Conversation

BrendanStans21
Copy link
Contributor

PinotDriver.connect() leaks the PinotClientTransport and PinotControllerTransport if an exception is thrown.

I added unit tests to test both a bad URL and a good URL that doesn't connect.

I performed manual tests of the closeResourceSafely method as it is a small private method. I performed the test by debugging the code through that method and verify the two resource do indeed close if there is an exception thrown.

@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (cad8c56) 61.66% compared to head (6732cc3) 61.83%.
Report is 2 commits behind head on master.

Files Patch % Lines
...main/java/org/apache/pinot/client/PinotDriver.java 75.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #12356      +/-   ##
============================================
+ Coverage     61.66%   61.83%   +0.16%     
+ Complexity     1150      207     -943     
============================================
  Files          2426     2426              
  Lines        132776   132790      +14     
  Branches      20541    20543       +2     
============================================
+ Hits          81874    82106     +232     
+ Misses        44884    44653     -231     
- Partials       6018     6031      +13     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (ø)
integration <0.01% <0.00%> (ø)
integration1 <0.01% <0.00%> (ø)
integration2 0.00% <0.00%> (?)
java-11 61.74% <75.00%> (+0.08%) ⬆️
java-21 61.69% <75.00%> (+33.98%) ⬆️
skip-bytebuffers-false 61.81% <75.00%> (+0.15%) ⬆️
skip-bytebuffers-true 61.63% <75.00%> (+33.93%) ⬆️
temurin 61.83% <75.00%> (+0.16%) ⬆️
unittests 61.82% <75.00%> (+0.16%) ⬆️
unittests1 46.89% <ø> (+0.06%) ⬆️
unittests2 27.83% <75.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@xiangfu0 xiangfu0 merged commit e1e22bd into apache:master Feb 13, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants