-
Notifications
You must be signed in to change notification settings - Fork 5.8k
ResourceWarning: unclosed socket reported whenever I use docker-compose stop #8085
Copy link
Copy link
Closed
Description
Description of the issue
Whenever I use the command stop from docker-compose I have multiple warning telling the docker socket wasn't closed properly:
sys:1: ResourceWarning: unclosed <socket.socket fd=14, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0> ResourceWarning: Enable tracemalloc to get the object allocation traceback
I noticed i get it too if I run docker-compose config.
Context information (for bug reports)
Output of docker-compose version
docker-compose version 1.28.0, build unknown
docker-py version: 4.4.1
CPython version: 3.9.1
OpenSSL version: OpenSSL 1.1.1i 8 Dec 2020
Output of docker version
Client:
Version: 20.10.2
API version: 1.41
Go version: go1.15.6
Git commit: 2291f610ae
Built: Tue Jan 19 17:19:21 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server:
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.15.6
Git commit: 8891c58a43
Built: Tue Jan 19 17:18:55 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b.m
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Output of docker-compose config
(Make sure to add the relevant -f and other flags)
docker-compose config
services:
redis:
image: redis:alpine
web:
build:
context: /home/arbaes/dkrcmp
ports:
- published: 5000
target: 5000
version: '3.9'
sys:1: ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Steps to reproduce the issue
FYI, i can reproduce with any project, including this one.
So i use it here for simplicty's sake
- Up the containers with
docker-compose up - Stop them with
docker-compose stop
Observed result
No errors but multiple ResourceWarnings for unclosed sockets
Expected result
No ResourceWarning and sockets properly closed
Stacktrace / full error message
❯ docker-compose up
Building with native build. Learn about native build in Compose here: https://docs.docker.com/go/compose-native-build/
Starting dkrcmp_redis_1 ... done
Starting dkrcmp_web_1 ... done
Attaching to dkrcmp_redis_1, dkrcmp_web_1
redis_1 | 1:C 29 Jan 2021 16:22:52.286 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1 | 1:C 29 Jan 2021 16:22:52.286 # Redis version=6.0.10, bits=64, commit=00000000, modified=0, pid=1, just started
redis_1 | 1:C 29 Jan 2021 16:22:52.286 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | 1:M 29 Jan 2021 16:22:52.287 * Running mode=standalone, port=6379.
redis_1 | 1:M 29 Jan 2021 16:22:52.287 # Server initialized
redis_1 | 1:M 29 Jan 2021 16:22:52.287 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 29 Jan 2021 16:22:52.287 * Loading RDB produced by version 6.0.10
redis_1 | 1:M 29 Jan 2021 16:22:52.287 * RDB age 247 seconds
redis_1 | 1:M 29 Jan 2021 16:22:52.287 * RDB memory usage when created 0.77 Mb
redis_1 | 1:M 29 Jan 2021 16:22:52.287 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 29 Jan 2021 16:22:52.287 * Ready to accept connections
web_1 | * Serving Flask app "app.py"
web_1 | * Environment: production
web_1 | WARNING: This is a development server. Do not use it in a production deployment.
web_1 | Use a production WSGI server instead.
web_1 | * Debug mode: off
web_1 | * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
^CGracefully stopping... (press Ctrl+C again to force)
Stopping dkrcmp_web_1 ... done
Stopping dkrcmp_redis_1 ... done
sys:1: ResourceWarning: unclosed <socket.socket fd=37, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed <socket.socket fd=24, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=/run/docker.sock>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed <socket.socket fd=26, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=/run/docker.sock>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Additional information
OS: Manjaro Linux
Kernel: 5.10.10-1-MANJARO
docker and docker-compose installed trough pacman, from community repos
Reactions are currently unavailable