docker / docker-py

A Python library for the Docker Engine API
https://docker-py.readthedocs.io/
Apache License 2.0
6.83k stars 1.67k forks source link

ResourceWarning: unclosed <socket.socket> [still occuring] #3268

Open kasium opened 5 months ago

kasium commented 5 months ago

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

Khushiyant commented 5 months ago

I'm not able to reproduce the warning. Also, Calling clear closes all urllib3.poolmanager.PoolManager instance so no issue here

kasium commented 5 months ago

Maybe it's worth to mention that I use 1.26.18