Skip to content

fix(outputs.opentelemetry): Prevent goroutine leak on gzip write failure#18418

Merged
mstrandboge merged 2 commits intoinfluxdata:masterfrom
skartikey:outputs_opentelemetry_gzip_fix
Mar 2, 2026
Merged

fix(outputs.opentelemetry): Prevent goroutine leak on gzip write failure#18418
mstrandboge merged 2 commits intoinfluxdata:masterfrom
skartikey:outputs_opentelemetry_gzip_fix

Conversation

@skartikey
Copy link
Copy Markdown
Contributor

Summary

Close the gzip pipe reader returned by CompressWithGzip in Export.
If the HTTP request fails or the server responds before consuming the full body, the gzip goroutine can block on PipeWriter.Write, causing a memory leak.

While reviewing #18416 (which fixed this in outputs.influxdb), I checked other CompressWithGzip call sites. outputs.opentelemetry was the only remaining caller missing the close. Other plugins (outputs.http, outputs.sensu, outputs.loki) already use defer rc.Close().

Related to #18413, #18416

Checklist

Related issues

resolves #

@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins labels Feb 26, 2026
Copy link
Copy Markdown
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

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

@skartikey I agree with @Hipska's comment, please directly assign to reader.

@srebhan srebhan removed their assignment Feb 27, 2026
@srebhan srebhan added area/telemetry All about OpenTelemetry and other telemetry variants ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. labels Feb 27, 2026
@telegraf-tiger
Copy link
Copy Markdown
Contributor

@mstrandboge mstrandboge merged commit c6c84ed into influxdata:master Mar 2, 2026
26 of 27 checks passed
@github-actions github-actions bot added this to the v1.38.0 milestone Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/telemetry All about OpenTelemetry and other telemetry variants fix pr to fix corresponding bug plugin/output 1. Request for new output plugins 2. Issues/PRs that are related to out plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants