-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
ResourceWarning: unclosed ssl.SSLSocket when using a session #3552
Comments
Hi @GergelyKalmar thanks for reaching out. By "The fix described there" in #454, which fix were you referring to? You may have been referencing this comment but I wanted to confirm:
Have you also tried this approach mentioned there? from contextmanager import closing
with closing(boto3.client(service_name='s3')) as client:
buckets = client.list_buckets() |
The info Tim linked above is largely correct but from the traceback this appears to be unrelated to the client itself. The warning is stemming from the credentials being used by the client which would not necessarily be cleaned up with a @GergelyKalmar could you provide some more information about how you're sourcing credentials for this profile and if you're using EC2 in this case? |
Sure, they are AWS SSO named profile credentials stored in Note that if I use the AWS SSO credentials as environment variables and call |
Ah, alright so it seems we may be creating a urllib3 connection pool, outside of our client connection pool, when retrieving current SSO credentials. I'm not immediately seeing where that's happening, but I'm going to flag this as a bug. We'll need to do a deeper dive to find the source and see if we can more gracefully close the connection. This shouldn't have any tangible performance impact as they'll be cleaned up as the connection pool flags them, but we likely can do better with the noise it generates. Thanks for the info, @GergelyKalmar! We'll update once we have more information. |
Hi, I have the same issue with python3.9. |
I'm getting this with just:
Versions:
|
Describe the bug
I'm getting the following warning when using a boto3 session to interact with the AWS API despite explicitly calling
close()
on the client:Expected Behavior
I was expecting to see no warning.
Current Behavior
The error described above.
Reproduction Steps
Create a script called
test.py
as follows:Run the script as
python3 -Wall test.py
and observe the warning.Possible Solution
No response
Additional Information/Context
The issue is similar to #454. The fix described there does not seem to work with sessions however.
SDK version used
boto3==1.26.47
Environment details (OS name and version, etc.)
Ubuntu 20.04 LTS
The text was updated successfully, but these errors were encountered: