-
Notifications
You must be signed in to change notification settings - Fork 300
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
DB containers produce ResourceWarning: unclosed <socket...> #379
Labels
Comments
I'm seeing unclosed socket warnings too, but seems like mine were caused by connections to docker. Here's the PR to fix it: #380 |
alexanderankin
added a commit
that referenced
this issue
Mar 9, 2024
Fixes the following warning ``` sys:1: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=/Users/rodrigo/.docker/run/docker.sock> ``` Related to #379 Co-authored-by: David Ankin <[email protected]>
bearrito
pushed a commit
to bearrito/testcontainers-python
that referenced
this issue
Mar 9, 2024
bearrito
pushed a commit
to bearrito/testcontainers-python
that referenced
this issue
Mar 9, 2024
…ainers#380) Fixes the following warning ``` sys:1: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=/Users/rodrigo/.docker/run/docker.sock> ``` Related to testcontainers#379 Co-authored-by: David Ankin <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
DbContainer
instances may trigger a warning regarding unclosed socket. This is caused by the fact thatDbContainer._connect
creates ansqlalchemy
engine and leaves it hanging after its done. I managed to reproduce it many time on an M1 macbook pro and fix it by changing the code to dispose the engine right before_connect
returns.Here is what the warning looks like:
To Reproduce
I run
pytest
with the following ini options and it fails every few runsRuntime environment
$ uname -a
Darwin Shais-MBP.lan 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul 5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000 arm64
Get the python version.
$ python --version
$ docker info
$ poetry show
The text was updated successfully, but these errors were encountered: