Skip to content

[BUG] panic in monitor.Start #13559

@dawagner

Description

@dawagner

Description

I'm getting this error on some occasions:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0xf601f2]
goroutine 107 [running]:
github.com/docker/compose/v5/pkg/compose.(*monitor).Start(0xc000530c40, {0x157a700, 0xc00003c820})
        github.com/docker/compose/v5/pkg/compose/monitor.go:150 +0xc12
github.com/docker/compose/v5/pkg/compose.(*composeService).Up.func7()
        github.com/docker/compose/v5/pkg/compose/up.go:278 +0x31
golang.org/x/sync/errgroup.(*Group).Go.func1()
        golang.org/x/sync@v0.19.0/errgroup/errgroup.go:93 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 1
        golang.org/x/sync@v0.19.0/errgroup/errgroup.go:78 +0x93

I believe it happens right after the end of a scheduled job which includes a docker compose run --rm --no-deps ... command. But it doesn't happen every time.

As a result, the docker compose up command that was running in the backgroud also terminates.

I had a glance at the code and it seems odd to me that the first branch of the if at

if errdefs.IsNotFound(err) {
falls through. Shouldn't it return? If the container couldn't be found, I don't expect inspect to be valid, right?

Steps To Reproduce

Unfortunately, I didn't manage to make a minimal reproducer yet.

Compose Version

Docker Compose version v5.0.2

Docker Environment

Client: Docker Engine - Community
 Version:    29.2.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.30.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.0.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 18
  Running: 18
  Paused: 0
  Stopped: 0
 Images: 9
 Server Version: 29.2.0
 Storage Driver: fuse-overlayfs
 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
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b98a3aace656320842a23f4a392a33f46af97866
 runc version: v1.3.0-0-g4ca628d1
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-21-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 62.69GiB
 Name: redacted
 ID: redacted
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
  ::1/128
 Live Restore Enabled: false
 Firewall Backend: iptables

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions