Skip to content

[BUG] SIGSEGV on Enable Watch #12907

@amietn

Description

@amietn

Description

Current behavior

  • Start a project with docker compose up
  • Enable Watch by pressing w
  • Docker compose crashes with the following error message:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x55c184531a5b]
w Enable Watch
goroutine 88 [running]:
github.com/docker/compose/v2/pkg/compose.(*Watcher).Start(0x0, {0x55c18515ed08?, 0xc000905230?})
        github.com/docker/compose/v2/pkg/compose/watch.go:87 +0xdb
github.com/docker/compose/v2/cmd/formatter.(*LogKeyboard).ToggleWatch.func1.1(...)
        github.com/docker/compose/v2/cmd/formatter/shortcut.go:284
github.com/docker/compose/v2/cmd/formatter.(*LogKeyboard).ToggleWatch.func1.EventWrapFuncForErrGroup.2(...)
        github.com/docker/compose/v2/internal/tracing/wrap.go:85
github.com/docker/compose/v2/cmd/formatter.(*LogKeyboard).ToggleWatch.func1()
        github.com/docker/compose/v2/cmd/formatter/shortcut.go:291 +0x85
created by github.com/docker/compose/v2/cmd/formatter.(*LogKeyboard).ToggleWatch in goroutine 48
        github.com/docker/compose/v2/cmd/formatter/shortcut.go:281 +0x17c

Expected behavior

No crash, watch mode should be enabled

Steps To Reproduce

Arch Linux 64 bit

In a docker compose project, type:

  • docker compose up

Then type:

  • w

Compose Version

Docker Compose version 2.37.0

Docker Environment

Client:
 Version:    28.2.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.24.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.37.0
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 6
  Running: 3
  Paused: 0
  Stopped: 3
 Images: 111
 Server Version: 28.2.0
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: true
  Native Overlay Diff: false
  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
 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: cb1076646aa3740577fafbf3d914198b7fe8e3f7.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.14.9-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.07GiB
 Name: foobar
 ID: BHJU:GWPK:TN6A:QF2R:WCKU:K62U:DGNA:NFW3:3MMH:PKKK:6ZTY:OYR6
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

This works correctly with docker compose 2.36.2

The issue happens only with docker compose 2.37.0 and therefore this suggests the bug was introduced in 2.37.0.
I hope this helps.

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