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

Make sure GZIPOutputStream is always closed #598

Merged

Conversation

turbanoff
Copy link
Contributor

@turbanoff turbanoff commented Oct 14, 2020

Leave GZIPOutputStream open is dangerous as it leads to native memory leak.
Use try-finally to make sure stream is always closed

private final LocalByteArray response = new LocalByteArray();
private final static String HEALTHY_RESPONSE = "Exporter is Healthy.";
private final Charset UTF_8 = Charset.forName("UTF-8");
Copy link
Contributor

Choose a reason for hiding this comment

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

This new indirection just makes the code harder to read for me.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still here.

Copy link
Contributor

@brian-brazil brian-brazil left a comment

Choose a reason for hiding this comment

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

Can you also add the DCO?

private final LocalByteArray response = new LocalByteArray();
private final static String HEALTHY_RESPONSE = "Exporter is Healthy.";
private final Charset UTF_8 = Charset.forName("UTF-8");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is still here.

@turbanoff turbanoff force-pushed the close_gzipoutputstream_always branch from 87ba15c to 421bfe3 Compare October 15, 2020 15:46
@brian-brazil brian-brazil merged commit 4618df7 into prometheus:master Oct 15, 2020
@brian-brazil
Copy link
Contributor

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants