ResourceWarning: unclosed <socket.socket> [still occuring]
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I can still see the resource warning from https://github.com/docker/docker-py/issues/1293 in some cases:
pytest.PytestUnraisableExceptionWarning: Exception ignored in: <socket.socket fd=-1, family=1, type=1, proto=0>
Traceback (most recent call last):
File "<frozen _collections_abc>", line 435, in __subclasshook__
ResourceWarning: unclosed <socket.socket fd=41, family=1, type=1, proto=0, raddr=/var/run/docker.sock>
I use python 3.12 and docker-py 7.1.
I guess that the close method of BaseHTTPAdapter in docker/transport/basehttpadapter.py should call close on the pool rather than clear
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in docker/transport/basehttpadapter.py at BaseHTTPAdapter.close and inspect how the pool is currently cleaned up. Reproduce the ResourceWarning with Python 3.12 and docker-py 7.1, then verify that closing the adapter no longer leaves the Docker socket open.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100