boto3 icon indicating copy to clipboard operation
boto3 copied to clipboard

(connection leak) occurs due botocore.exceptions.EventStreamError in boto3.client( "bedrock-agent-runtime" ).invoke_agent

Open FireballDWF opened this issue 7 months ago • 1 comments

Describe the bug

When a throttlingException gets raised as a botocore.exceptions.EventStreamError by client.invoke_agent when client=boto3.client( "bedrock-agent-runtime" ), a side effect is a Connection Leak.

Figure it is in the ServiceTeam's interest to get these Connection Leaks closed within boto3 or botocore as doing so would result in fewer open and idle connections to their service endpoints.

Regression Issue

  • [ ] Select this option if this issue appears to be a regression.

Expected Behavior

connection is returned to the pool before the botocore.exceptions.EventStreamError is raised

Current Behavior

Connection Leak can be observed by receiving the following log when the number of throttlingExceptions is equal to the value of max_pool_connections

[2025-05-26 23:19:33,755] p43062 {connectionpool.py:327} WARNING - Connection pool is full, discarding connection: bedrock-agent-runtime.us-east-1.amazonaws.com. Connection pool size: 10

Reproduction Steps

Have a Terraform based IaC+python file to reproduce it 100% of the time, but it is not concise yet. Submitting this report in the meantime as this report should be sufficient to do a code review of the relevant handling of the connection from the exception. If targeted Code Review can't find it, slack filiatra@ and I'll work on creating a branch of my work which is more concise for reproducing it.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.38.23

Environment details (OS name and version, etc.)

MacOS Sequoia 15.5 with python 3.13.3_1 (Homebrew) env

FireballDWF avatar May 27 '25 04:05 FireballDWF

Hello @FireballDWF, thanks for reaching out. For troubleshooting, can you provide the full debug logs by adding boto3.set_stream_logger('') and removing all sensitive information. Also, if possible to provide code replication. Thank you.

adev-code avatar Jun 09 '25 16:06 adev-code

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Jun 22 '25 00:06 github-actions[bot]

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Sep 15 '25 23:09 github-actions[bot]