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: fix memory leak on failed http requests #59

Merged
merged 1 commit into from
Feb 5, 2025
Merged

Conversation

mgoetzegb
Copy link
Member

What

Fix memory leak on failed http requests.

In many error cases the http response body was not closed as the defer statement closing the body was only executed after the error handling.

Thus the underlying connection can't be reused. This caused the creation of many goroutines which are never discarded, massively increasing the memory consumption.

A prominent scenario is if a CSAF provider does not provide both sha256 and sha512 checksums.

Why

Ever growing memory consumption is an issue.

References

Jira Ticket: VTI-405

In many error cases the http response body was not closed as the `defer` statement was only executed after the error handling.

Thus the connection can't be reused. This caused the creation of many goroutines, massively increasing the memory consumption. A prominent scenario is if a CSAF provider does not provide both sha256 and sha512 checksums.
@mgoetzegb mgoetzegb requested a review from a team as a code owner February 4, 2025 16:40
@mgoetzegb mgoetzegb added the patch release Set label to create a patch release label Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

Conventional Commits Report

Type Number
Bug Fixes 1

🚀 Conventional commits found.

@mgoetzegb mgoetzegb merged commit b700519 into main-gb Feb 5, 2025
4 of 5 checks passed
@mgoetzegb mgoetzegb deleted the fix-memory-leak branch February 5, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch release Set label to create a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants