Is there an existing issue for this?
Name of mod
swag-ondemand
Name of base container
swag
Current Behavior
When the Docker daemon is upgraded (e.g., via unattended-upgrades), the service restart takes long enough for the /var/run/docker.sock to be removed and recreated. During this window, swag-ondemand.py enters an unthrottled infinite loop, flooding ondemand.log with 502 Bad Gateway / 503 Service Unavailable errors (hundreds per second). This quickly consumes all host disk space, leading to OSError: [Errno 28] No space left on device and triggering a cascading failure of all other containers on the host.
I've verified the code: the issue is located in the run(self) method of ContainerThread class, where the except block executes a logging.exception(e) without any time.sleep(), causing a tight loop that creates hundreds of log entries per second upon connection failure.
Expected Behavior
The script should handle the temporary Docker daemon unavailability gracefully. It should implement a backoff or a delay in the except block of the main loop to prevent log flooding and resource exhaustion during daemon maintenance.
Steps To Reproduce
The issue is specifically reproducible during an automated Docker package upgrade. It is difficult to reproduce with a simple systemctl restart docker as the socket is often replaced fast enough to avoid triggering the sustained 502/503 loop.
- Ensure swag-ondemand is running.
- Trigger an apt upgrade docker-ce (which performs a full package replacement/restart).
- Observe ondemand.log growing at high speed due to the lack of a delay in the exception handler.
Environment
- OS: Ubuntu 24.04.3
- How docker service was installed: Docker's apt repository
CPU architecture
x86-64
Docker creation
services:
nginx:
image: lscr.io/linuxserver/nginx:latest
container_name: redacted
networks:
- swag
environment:
PUID: ${PUID}
PGID: ${PGID}
TZ: ${TIMEZONE}
volumes:
- ./config:/config
- /media/library/archive/redacted:/config/www
restart: unless-stopped
labels:
- swag=enable
- swag_url=sub.${DOMAIN_NAME}
- swag_port=80
- swag_auth=authelia
- swag_ondemand=enable
- swag_server_custom_directive=include /config/nginx/ondemand.conf;
- swag_ondemand_urls=https://sub.
networks:
swag:
external: true
Container logs
Is there an existing issue for this?
Name of mod
swag-ondemand
Name of base container
swag
Current Behavior
When the Docker daemon is upgraded (e.g., via unattended-upgrades), the service restart takes long enough for the /var/run/docker.sock to be removed and recreated. During this window, swag-ondemand.py enters an unthrottled infinite loop, flooding ondemand.log with 502 Bad Gateway / 503 Service Unavailable errors (hundreds per second). This quickly consumes all host disk space, leading to OSError: [Errno 28] No space left on device and triggering a cascading failure of all other containers on the host.
I've verified the code: the issue is located in the run(self) method of ContainerThread class, where the except block executes a logging.exception(e) without any time.sleep(), causing a tight loop that creates hundreds of log entries per second upon connection failure.
Expected Behavior
The script should handle the temporary Docker daemon unavailability gracefully. It should implement a backoff or a delay in the except block of the main loop to prevent log flooding and resource exhaustion during daemon maintenance.
Steps To Reproduce
The issue is specifically reproducible during an automated Docker package upgrade. It is difficult to reproduce with a simple systemctl restart docker as the socket is often replaced fast enough to avoid triggering the sustained 502/503 loop.
Environment
CPU architecture
x86-64
Docker creation
services: nginx: image: lscr.io/linuxserver/nginx:latest container_name: redacted networks: - swag environment: PUID: ${PUID} PGID: ${PGID} TZ: ${TIMEZONE} volumes: - ./config:/config - /media/library/archive/redacted:/config/www restart: unless-stopped labels: - swag=enable - swag_url=sub.${DOMAIN_NAME} - swag_port=80 - swag_auth=authelia - swag_ondemand=enable - swag_server_custom_directive=include /config/nginx/ondemand.conf; - swag_ondemand_urls=https://sub. networks: swag: external: trueContainer logs
.