Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] --wait-timeout option not working with 'service_completed_successfully' dependency #12134

Closed
norbert-balazs opened this issue Sep 17, 2024 · 0 comments · Fixed by #12156

Comments

@norbert-balazs
Copy link

Description

Using the --wait-timeout option with --wait is supposed to ensure that the command doesn't hang indefinitely in case of issues. However the command still hangs when the compose file contains a dependency with a service_completed_successfully condition.

The --timeout option doesn't seem to be working either in this scenario.

This bug was found in a real compose configuration when one of our setup containers got stuck. Below is just a minimal reproduction.

The expected behavior would be that the docker compose command exits after the specified wait-timeout.

Steps To Reproduce

  1. Use the following compose file:
services:
  long_setup:
    image: alpine:latest
    #command: "sh -c 'while true; do sleep 1; done'"
    command: "sh -c 'sleep 10; exit 0'"
  server:
    image: alpine:latest
    command: "sh -c 'while true; do sleep 1; echo 'running'; done'"
    depends_on:
      long_setup:
        condition: service_completed_successfully
  1. Run it with docker compose up -d --wait --wait-timeout 1, or any timeout less than 10.
  2. Observe the command not failing in the defined timeout.
  3. Change to the commented out command containing the infinite loop
  4. Run docker compose up -d --wait --wait-timeout 1 again.
  5. Observe the command running indefinitely.

Run the above with docker compose up -d --timeout 1 or docker compose up --timeout 1, and observe that the --timeout option doesn't work either.

Compose Version

Docker Compose version v2.29.2

Docker Environment

Client: Docker Engine - Community
 Version:    27.2.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.16.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 153
 Server Version: 27.2.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
 runc version: v1.1.14-0-g2c9f560
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.0-40-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 62.41GiB
 Name: -
 ID: 0036cd9f-4a66-42a6-a7eb-f740a36de7f9
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant