[Bug] Missing stream.Close() in processStreamingOutput causes potential resource leaks

Open
#7,740 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@rlhagerm is already working on this.

Since Feb 18, 2026.

Assessment

This issue has not been assessed yet.

Description

Bug

Hi team,

https://github.com/awsdocs/aws-doc-sdk-examples/blob/12ee8a27fa96b7a944d1b22f58ca36ac5b4dcdc5/gov2/bedrock-runtime/actions/invoke_model_with_response_stream.go#L107

While this works perfectly for the CLI use case, Close() isn't called on the event stream. The SDK documentation notes this is required to clean up the underlying reader/writer.

If customers copy this snippet into a long-running web server (instead of a CLI), it will leak goroutines. Adding a defer stream.Close() would make this safe for copy-pasting into production apps.

Dominant language
Java
Stars
10.5k
Forks
5.8k
Avg merge
2d 21h
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from awsdocs/aws-doc-sdk-examples

All issues in awsdocs/aws-doc-sdk-examples

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.