-
Notifications
You must be signed in to change notification settings - Fork 15
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: unclosed body causing resource leak #94
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
- Coverage 85.16% 79.21% -5.95%
==========================================
Files 14 14
Lines 1112 1121 +9
==========================================
- Hits 947 888 -59
- Misses 137 203 +66
- Partials 28 30 +2 ☔ View full report in Codecov by Sentry. |
I don't believe this has any behavioural change, i.e. the I can reduce this down entirely to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your PR 👍
The failing code coverage check is due to our CI settings. Forked repositories do not run integration tests against InfluxDB Cloud to keep credentials secure. This will be addressed once InfluxDB Edge OSS is released.
Could you please update the CHANGELOG.md
? After that, we'll be able to merge your awesome PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bednar Sure thing 👍
As a small heads up for this. I raised this in the PR description, but this Do we want to add those to this PR in that case or save the Edit: It looks like I can add |
Yes, it is good approach. Thanks @jdockerty |
So I believe this is a bit of double-edged sword unfortunately. Using For example, by disabling the analysis of tests it looks like the golangci-lint run -v --tests=false --config .golangci.yml
...snip
influxdb3/query.go:70:18 unused func `(*Client).setQueryClient` is unused
1 issues:
* unused: 1 In actual fact this isn't the case though, it is used, but within tests 😄
@bednar Any preference on how to proceed with this? I can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdockerty, thank you for your efforts ❤️
I've disabled bodyclose
from the CI checks, and we can consider re-enabling it in a subsequent PR or during the enhancement of the golangci-lint configuration as described here: Enhance golangci-lint Configuration.
Proposed Changes
When the returned
Response
's body isnil
, the caller of the function is expected toClose
the body. If this is not done, it can lead to a resource leak.Ref
This is also caught by a
golangci-lint
check ofbodyclose
, e.g. running frommain
:Other references:
This is mainly believed to effect a Clustered customer, but I've also addressed the lint elsewhere too for Cloud Dedicated/Serverless1.
Checklist
Footnotes
This also shows up in various tests, but I've opted to leave this for now because they are ephemeral compared to client usage. If needs be I think someone can address these in a follow-up PR. ↩