moby: Intermittent "unexpected EOF" while downloading container layers when built with go 1.24

Description

Since updating to 28.0.0, I’m getting a lot of “unexpected EOF” errors when bringing up a series of containers. Unfortunately this seems to happen at random, so there’s no safe reproducer. The connection is fast and reliable, there is likely no massive timeout involved. I’ve seen it happening both with docker pull and docker compose up while pulling layers.

Setting "max-download-attempts": 5000 (or even more ridiculous values) in /etc/docker/daemon.json doesn’t fix it; chances are that since the error is something other than connection timed out or so, docker doesn’t recognize this as a download failure and therefore doesn’t make another download attempt.

[+] Running 12/14
 ⠙ dashboard [⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿] 6.277MB / 6.277MB Pulling                                                                                                                                                       6.1s 
   ✔ 804c8aba2cc6 Already exists                                                                                                                                                                             0.0s 
   ✔ 2ae710cd8bfe Already exists                                                                                                                                                                             0.0s 
   ✔ d462aa345367 Already exists                                                                                                                                                                             0.0s 
   ✔ 0f8b424aa0b9 Already exists                                                                                                                                                                             0.0s 
   ✔ d557676654e5 Already exists                                                                                                                                                                             0.0s 
   ✔ c8022d07192e Already exists                                                                                                                                                                             0.0s 
   ✔ d858cbc252ad Already exists                                                                                                                                                                             0.0s 
   ✔ 1069fc2daed1 Already exists                                                                                                                                                                             0.0s 
   ✔ b40161cd83fc Pull complete                                                                                                                                                                              0.5s 
   ✔ 5318d93a3a65 Pull complete                                                                                                                                                                              0.5s 
   ✔ 307c1adadb60 Pull complete                                                                                                                                                                              3.1s 
   ⠧ 258b5bb46f9a Extracting      [==================================================>]  5.791MB/5.791MB                                                                                                     4.8s 
   ✔ 51fea5d3cd54 Download complete                                                                                                                                                                          2.2s 
unexpected EOF
exit status 1

Simply running the same docker pull or docker compose command again “fixes” it most of the time (and when it doesn’t, surely running it a third or fourth time does).

Reproduce

  1. “docker pull” a container, preferrable one with many layers
  2. If it succeeds, try again, at some point it will result in “unexpected EOF”

Expected behavior

it works

docker version

Client:
 Version:           28.0.0
 API version:       1.48
 Go version:        go1.24.0
 Git commit:        
 Built:             Thu Feb 20 22:16:09 2025
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          28.0.0
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.24.0
  Git commit:       b0f5bc3
  Built:            Thu Feb 20 22:15:42 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          2.0.2
  GitCommit:        .m
 runc:
  Version:          1.20 [crun]
  GitCommit:        1.20-1
 docker-init:
  Version:          0.19.0
  GitCommit:

docker info

Client:
 Version:    28.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.21.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.33.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 9
  Running: 9
  Paused: 0
  Stopped: 0
 Images: 10
 Server Version: 28.0.0
 Storage Driver: btrfs
  Btrfs: 
 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: .m
 runc version: 1.20-1 [crun]
 init version: 
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.13.3-server-1omv2590
 Operating System: OpenMandriva Lx 25.90 (Nickel) Cooker
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 15.26GiB
 Name: updatetestamd.federatedcomputer.net
 ID: 5419e1b8-b71b-4351-9772-dc2646c8cd39
 Docker Root Dir: /federated/docker
 Debug Mode: false
 Username: *******
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Additional Info

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 32
  • Comments: 115 (33 by maintainers)

Most upvoted comments

So I’ve gone ahead and bisected from Go 1.23.0 to 1.24.0, below are the results:

git bisect start
# status: waiting for both good and bad commits
# bad: [3901409b5d0fb7c85a3e6730a59943cc93b2835c] [release-branch.go1.24] go1.24.0
git bisect bad 3901409b5d0fb7c85a3e6730a59943cc93b2835c
# good: [6885bad7dd86880be6929c02085e5c7a67ff2887] [release-branch.go1.23] go1.23.0
git bisect good 6885bad7dd86880be6929c02085e5c7a67ff2887
# good: [5e8a7316658c2f300a375041b6e0a606fec4c5f2] README: fix CC BY license name
git bisect good 5e8a7316658c2f300a375041b6e0a606fec4c5f2
# bad: [87a89fa45130d4406fa4d9f0882b9c5014240d03] runtime: add the checkPtraceScope to skip certain tests
git bisect bad 87a89fa45130d4406fa4d9f0882b9c5014240d03
# good: [1b5ae45181ef5274045b9b93ae0603ebb34fa811] os/user: User.GroupIds shouldn't error on users with no groups
git bisect good 1b5ae45181ef5274045b9b93ae0603ebb34fa811
# good: [ba42120723a8bb4161c4f54c93f7ab3234923473] runtime: properly compute whether PC is inside vDSO pages
git bisect good ba42120723a8bb4161c4f54c93f7ab3234923473
# bad: [0733682e5ff4cd294f5eccb31cbe87a543147bc6] internal/runtime/maps: initial swiss table map implementation
git bisect bad 0733682e5ff4cd294f5eccb31cbe87a543147bc6
# bad: [e86982c515ba4a494fb1f8e1367f4238a2b59c2e] encoding/json: add omitzero option
git bisect bad e86982c515ba4a494fb1f8e1367f4238a2b59c2e
# good: [6536c207c2309da7c1c21e3669f8ddf491e31f5b] net: improve GODEBUG=netdns=1 debug messages
git bisect good 6536c207c2309da7c1c21e3669f8ddf491e31f5b
# bad: [0206eb9679dd3819c44912e6ebdba3b0fbf959a3] README.vendor: add note about GOROOT, recommend fresh go
git bisect bad 0206eb9679dd3819c44912e6ebdba3b0fbf959a3
# bad: [f4b7291d73c40af90fdbc5fa0d72a26c5f127931] crypto/internal/randutil: use math/rand/v2
git bisect bad f4b7291d73c40af90fdbc5fa0d72a26c5f127931
# good: [327074551a2f22f2c0b8e444d1673c86f77ca745] cmd/go: exit non-zero if version -m is used with a non-Go file
git bisect good 327074551a2f22f2c0b8e444d1673c86f77ca745
# bad: [3637ebf1e0d833234c1025db1faceeae6fe6ecbb] crypto/internal/cryptotest: fix typos in AEAD test comments
git bisect bad 3637ebf1e0d833234c1025db1faceeae6fe6ecbb
# bad: [86781963cc2bf0d3dbd1eccebd8a2f080846f3ee] runtime: align vgetrandom states to cache line
git bisect bad 86781963cc2bf0d3dbd1eccebd8a2f080846f3ee
# first bad commit: [86781963cc2bf0d3dbd1eccebd8a2f080846f3ee] runtime: align vgetrandom states to cache line

With the culprit identified being this commit:

86781963cc2bf0d3dbd1eccebd8a2f080846f3ee is the first bad commit
commit 86781963cc2bf0d3dbd1eccebd8a2f080846f3ee (HEAD)
Author: Jason A. Donenfeld <Jason@zx2c4.com>
Date:   Sun Sep 29 04:24:00 2024 +0200

    runtime: align vgetrandom states to cache line

    This prevents false sharing, which makes a large difference on machines
    with several NUMA nodes, such as this dual socket server:

    cpu: Intel(R) Xeon(R) Gold 6338 CPU @ 2.00GHz
                          │    sec/op    │    sec/op     vs base                │
    ParallelGetRandom-128   0.7944n ± 5%   0.4503n ± 0%  -43.31% (p=0.000 n=10)

                          │     B/s      │     B/s       vs base                │
    ParallelGetRandom-128   4.690Gi ± 5%   8.272Gi ± 0%  +76.38% (p=0.000 n=10)

    Change-Id: Id4421e9a4c190b38aff0be4c59e9067b0a38ccd7
    Reviewed-on: https://go-review.googlesource.com/c/go/+/616535
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Jason Donenfeld <Jason@zx2c4.com>
    Reviewed-by: David Chase <drchase@google.com>
    Reviewed-by: Michael Pratt <mpratt@google.com>

 src/internal/syscall/unix/getrandom_linux_test.go | 22 ++++++++++++++++++++++
 src/runtime/vgetrandom_linux.go                   | 12 ++++++++----
 2 files changed, 30 insertions(+), 4 deletions(-)
 create mode 100644 src/internal/syscall/unix/getrandom_linux_test.go

If anybody else on an Arch-based system would like to assist with confirming the findings, I’ve attached Docker compiled against the last known good/bad commits here.

Arch will push a patched go package and rebuild docker in a few hours.

Feedback: Applied docker=1:28.0.4-2 (rebuilt with patched golang) on 2 Arch Linux based servers for serveral days and no more unexpected EOF occurred. 😉

@nightah I took a look at the stack trace you posted earlier along with some other ones that looked similar and traced through the go runtime code, think I managed to find a simple repro of this out of docker/dagger:

package main

import (
    "runtime"
    "time"

    "golang.org/x/sys/unix"
)

const i = 16*1024
const bs = 1024
const sl = 1*time.Millisecond

func main() {
    for {
        time.Sleep(sl)
        go func() {
            runtime.LockOSThread()
            b := make([]byte, bs)
            for range i {
                _, err := unix.Getrandom(b, 0)
                if err != nil { panic(err) }
            }
        }()
        b := make([]byte, bs)
        _, err := unix.Getrandom(b, 0)
        if err != nil { panic(err) }
    }
}

On an x86 Arch Linux latest ec2 AMI (Linux ip-172-31-34-47 6.13.8-1-ec2 #1 SMP PREEMPT_DYNAMIC Mon, 24 Mar 2025 21:00:24 +0000 x86_64 GNU/Linux) running that binary will segfault after ~5ish seconds.

The resulting core dumps have stack traces like:

[arch@ip-172-31-34-47 test]$ coredumpctl info 854360
           PID: 854360 (main)
           UID: 1000 (arch)
           GID: 1000 (arch)
        Signal: 11 (SEGV)
     Timestamp: Wed 2025-04-02 20:09:55 UTC (10s ago)
  Command Line: ./main
    Executable: /home/arch/test/main
 Control Group: /user.slice/user-1000.slice/session-25.scope
          Unit: session-25.scope
         Slice: user-1000.slice
       Session: 25
     Owner UID: 1000 (arch)
       Boot ID: 8235bd622064418bb4c88fcfb47876ec
    Machine ID: 51b81e352cd5447891aebaad822ce91e
      Hostname: ip-172-31-34-47
       Storage: /var/lib/systemd/coredump/core.main.1000.8235bd622064418bb4c88fcfb47876ec.854360.1743624595000000.zst (present)
  Size on Disk: 144.4K
       Message: Process 854360 (main) of user 1000 dumped core.

                Stack trace of thread 854441:
                #0  0x0000000000410238 runtime.mallocgcSmallNoscan (/home/arch/test/main + 0x10238)
                #1  0x0000000000463bd9 runtime.mallocgc (/home/arch/test/main + 0x63bd9)
                #2  0x0000000000466149 runtime.growslice (/home/arch/test/main + 0x66149)
                #3  0x00000000004613d6 runtime.vgetrandomPutState (/home/arch/test/main + 0x613d6)
                #4  0x000000000043a265 runtime.mdestroy (/home/arch/test/main + 0x3a265)
                #5  0x0000000000439f1f runtime.mstart0 (/home/arch/test/main + 0x39f1f)
                #6  0x0000000000468b65 runtime.mstart (/home/arch/test/main + 0x68b65)
                #7  0x000000000046c8ef runtime.clone (/home/arch/test/main + 0x6c8ef)

                Stack trace of thread 854440:
                #0  0x00007efcdb520411 n/a (linux-vdso.so.1 + 0x1411)
                #1  0x000000000046ca18 runtime.vgetrandom1 (/home/arch/test/main + 0x6ca18)
                #2  0x000000c00019eb48 n/a (n/a + 0x0)
                #3  0x0000000000467cd5 runtime.vgetrandom (/home/arch/test/main + 0x67cd5)
                #4  0x00000000004738a6 golang.org/x/sys/unix.Getrandom (/home/arch/test/main + 0x738a6)
                #5  0x0000000000473ea9 main.main.func1 (/home/arch/test/main + 0x73ea9)
                #6  0x000000000046aa81 runtime.goexit (/home/arch/test/main + 0x6aa81)

Which is quite similar to the others posted.


I am far from a go runtime expert, but my theory (which lead to the above repro code) is that:

  1. https://github.com/golang/go/commit/eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13 is the culprit
  2. You need to be on Linux 6.11+ where getrandom can be optimized to use the vdso
  3. The problem occurs because the runtime can attempt to expand the size of a slice while a goroutine’s thread is being spun down: https://github.com/golang/go/blame/3637ebf1e0d833234c1025db1faceeae6fe6ecbb/src/runtime/vgetrandom_linux.go#L77
    • This is why I have a bunch of runtime.LockOSThread stuff. I need to test more to confirm, but think that might be important for the broken codepaths to trigger and would explain why docker+dagger were affected but not many other go users seemingly

I think this is enough to open an issue in Go. I’ll do some more confirmation and try to trim the repro down and then open one (linking to this issue and the dagger one)

cc @thaJeztah

Update 1:

Exact same failure pattern also exist in dockerd 28.0.1 compiled with go 1.24.0 or 1.24.1, while dockerd 28.0.1 compiled with go 1.23.6 or 1.23.7 works fine.

Update 2:

This issue seems more likely to be reproduced when pulling a new version of an image where the new version and old version shares some layers. (typically a same base image, i.e. alpine, ubuntu, python, etc) When pulling a absolutely new image, this issue is not likely to occur.

To anyone who wants to add a comment saying they still have this bug – check that your Docker is compiled by go1.24.3 (by running e.g. docker version | grep Go.

If you see Go 1.24 version older than go1.24.3, file a bug with your distro vendor.

OHMAN, Y’all make me happy here! Thanks everyone here for helping out on this one 🤞 hope that’s indeed gonna help fix the issue, but this looks REALLY hopeful!

I would hold off on reporting this upstream just for now, I’ve just reproduced the issue looping the test with 1.24.2 with 86781963cc2bf0d3dbd1eccebd8a2f080846f3ee reverted.

Going back and reconfirming directly against 86781963cc2bf0d3dbd1eccebd8a2f080846f3ee and 327074551a2f22f2c0b8e444d1673c86f77ca745 as I’m not sure if any of the other commits between 1.23.0 vs 1.24.2 could potentially impact this.

EDIT: It looks like 86781963cc2bf0d3dbd1eccebd8a2f080846f3ee and 327074551a2f22f2c0b8e444d1673c86f77ca745 are not the last bad/good commits, apologies for the false alarm.

unexpected EOF
Run #16: Bad commit
./test.sh 50  76.69s user 20.72s system 3% cpu 52:15.92 total

I’m back to bisecting and retracing steps to see what I find. The inability to reliably produce the error is making this hard to confirm. I’ll just make sure to run the testing in a loop for a several hours on the good commits to hone in on this.

But the response was that this should be dealt with upstream which I’m assuming is here?

The ultimate upstream here is Golang; it’s a bug in Go; it’s not just docker that’s affected, for example, dagger also has similar issues with go1.24 (see https://github.com/dagger/dagger/issues/9759)

With no consistent reproducer, it’s not sure if a bug-report will be actionable on their (Golang) side though.

I’d like to do the same for Arch but new registrations are currently blocked on their bug tracking site:

https://gitlab.archlinux.org/users/sign_in

Is there anyone else on this thread who could do the honours please?

https://gitlab.archlinux.org/archlinux/packaging/packages/docker/-/issues/3 I have submitted an issue to the maintainer of the docker package in Arch Linux.

Go 1.24 switched to using swiss tables for maps, and a new internal mutex. Those can be disabled during compile time by setting GOEXPERIMENT=noswissmap and GOEXPERIMENT=nospinbitmutex, respectively.

If there are any advanced users who can recompile docker with one or both of these environment variables set and retest the resulting binary, that might help to find the suspect.

I’ve also checked Go 1.24.2 milestone but don’t see anything that jumps out.

I’m fairly confident that @sipsma is correct.

I had to do a local replace of x/sys as I couldn’t get the minimal repro to build with Go<1.24 due to a build constraint specifically for Go >=1.24 on the vgetrandom call.

Anything before https://github.com/golang/go/commit/eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13 will obviously fail to compile.

Also, the mildly educated guess, which is tied to what I initially thought to be the culprit commit, makes sense too. It certainly seems like that performance increase amplifies the problem, as it’s much more commonly reproducible from that commit onwards, just with Docker pulls.

Final bisect below:

git bisect start
# status: waiting for both good and bad commits
# bad: [3901409b5d0fb7c85a3e6730a59943cc93b2835c] [release-branch.go1.24] go1.24.0
git bisect bad 3901409b5d0fb7c85a3e6730a59943cc93b2835c
# good: [6885bad7dd86880be6929c02085e5c7a67ff2887] [release-branch.go1.23] go1.23.0
git bisect good 6885bad7dd86880be6929c02085e5c7a67ff2887
# good: [5e8a7316658c2f300a375041b6e0a606fec4c5f2] README: fix CC BY license name
git bisect good 5e8a7316658c2f300a375041b6e0a606fec4c5f2
# bad: [87a89fa45130d4406fa4d9f0882b9c5014240d03] runtime: add the checkPtraceScope to skip certain tests
git bisect bad 87a89fa45130d4406fa4d9f0882b9c5014240d03
# good: [1b5ae45181ef5274045b9b93ae0603ebb34fa811] os/user: User.GroupIds shouldn't error on users with no groups
git bisect good 1b5ae45181ef5274045b9b93ae0603ebb34fa811
# good: [ba42120723a8bb4161c4f54c93f7ab3234923473] runtime: properly compute whether PC is inside vDSO pages
git bisect good ba42120723a8bb4161c4f54c93f7ab3234923473
# bad: [0733682e5ff4cd294f5eccb31cbe87a543147bc6] internal/runtime/maps: initial swiss table map implementation
git bisect bad 0733682e5ff4cd294f5eccb31cbe87a543147bc6
# bad: [e86982c515ba4a494fb1f8e1367f4238a2b59c2e] encoding/json: add omitzero option
git bisect bad e86982c515ba4a494fb1f8e1367f4238a2b59c2e
# bad: [6536c207c2309da7c1c21e3669f8ddf491e31f5b] net: improve GODEBUG=netdns=1 debug messages
git bisect bad 6536c207c2309da7c1c21e3669f8ddf491e31f5b
# good: [5fe3b31cf898de6fbc4f8ac524e16238a9a85e66] go/types, types2: remove dependency on Scope.Contains in resolver
git bisect good 5fe3b31cf898de6fbc4f8ac524e16238a9a85e66
# good: [6ad3933e285b036137a339f598f00a21578fcbfb] go/types, types2: move go/types-only Scope methods into scopes2.go
git bisect good 6ad3933e285b036137a339f598f00a21578fcbfb
# bad: [eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13] runtime: use vDSO for getrandom() on linux
git bisect bad eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13
# good: [677b6cc17544e5e667d4bb67d063f5d775c69e32] test: simplify issue 69434 test
git bisect good 677b6cc17544e5e667d4bb67d063f5d775c69e32
# first bad commit: [eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13] runtime: use vDSO for getrandom() on linux

@sipsma ironically, the below commit is what I was testing overnight in my latest bisect, and I was unable to reproduce the crash over 12 hours of continual testing.

  1. golang/go@eb6f2c2 is the culprit

I’ll try with your minimal reproduction too, though here’s where I’m at so far with two more bisect steps to go:

git bisect start
# status: waiting for both good and bad commits
# bad: [3901409b5d0fb7c85a3e6730a59943cc93b2835c] [release-branch.go1.24] go1.24.0
git bisect bad 3901409b5d0fb7c85a3e6730a59943cc93b2835c
# good: [6885bad7dd86880be6929c02085e5c7a67ff2887] [release-branch.go1.23] go1.23.0
git bisect good 6885bad7dd86880be6929c02085e5c7a67ff2887
# good: [5e8a7316658c2f300a375041b6e0a606fec4c5f2] README: fix CC BY license name
git bisect good 5e8a7316658c2f300a375041b6e0a606fec4c5f2
# bad: [87a89fa45130d4406fa4d9f0882b9c5014240d03] runtime: add the checkPtraceScope to skip certain tests
git bisect bad 87a89fa45130d4406fa4d9f0882b9c5014240d03
# good: [1b5ae45181ef5274045b9b93ae0603ebb34fa811] os/user: User.GroupIds shouldn't error on users with no groups
git bisect good 1b5ae45181ef5274045b9b93ae0603ebb34fa811
# good: [ba42120723a8bb4161c4f54c93f7ab3234923473] runtime: properly compute whether PC is inside vDSO pages
git bisect good ba42120723a8bb4161c4f54c93f7ab3234923473
# bad: [0733682e5ff4cd294f5eccb31cbe87a543147bc6] internal/runtime/maps: initial swiss table map implementation
git bisect bad 0733682e5ff4cd294f5eccb31cbe87a543147bc6
# bad: [e86982c515ba4a494fb1f8e1367f4238a2b59c2e] encoding/json: add omitzero option
git bisect bad e86982c515ba4a494fb1f8e1367f4238a2b59c2e
# bad: [6536c207c2309da7c1c21e3669f8ddf491e31f5b] net: improve GODEBUG=netdns=1 debug messages
git bisect bad 6536c207c2309da7c1c21e3669f8ddf491e31f5b
# good: [5fe3b31cf898de6fbc4f8ac524e16238a9a85e66] go/types, types2: remove dependency on Scope.Contains in resolver
git bisect good 5fe3b31cf898de6fbc4f8ac524e16238a9a85e66
# good: [6ad3933e285b036137a339f598f00a21578fcbfb] go/types, types2: move go/types-only Scope methods into scopes2.go
git bisect good 6ad3933e285b036137a339f598f00a21578fcbfb
# good: [eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13] runtime: use vDSO for getrandom() on linux
git bisect good eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13

@nightah, just to be clear, the variable name is GOEXPERIMENT, not GOO...

I tested GOEXPERIMENT=nosynchashtriemap, got a crash.

I also tested GOEXPERIMENT=noswissmap,nospinbitmutex,nosynchashtriemap, and it still crashed, though the probability is lower in this case.

I tried the 28.0.1 build on Manjaro with export GOEXPERIMENT=noswissmap,nospinbitmutex, but it crashed as well.

docker version
Client:
 Version:           28.0.1
 API version:       1.48
 Go version:        go1.24.1 X:noswissmap,nospinbitmutex
 Git commit:        068a01ea94
 Built:             Thu Mar 20 14:32:57 2025
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          28.0.1
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.24.1 X:noswissmap,nospinbitmutex
  Git commit:       bbd0a17ccc
  Built:            Thu Mar 20 14:32:57 2025
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v2.0.4
  GitCommit:        1a43cb6a1035441f9aca8f5666a9b3ef9e70ab20.m
 runc:
  Version:          1.2.6
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Go 1.24 switched to using swiss tables for maps, and a new internal mutex. Those can be disabled during compile time by setting GOEXPERIMENT=noswissmap and GOEXPERIMENT=nospinbitmutex, respectively.

I tried building the Arch Linux package with GOOEXPERIMENT=noswissmap,nospinbitmutex with no success, i.e. the crashes still happen.

It’s definitely not some microarchitecture thing, given it can be triggered even on entirely different architectures (x86_64 and aarch64). I’ve seen the crashes on an Ampere aarch64 box, a Ryzen 9 5950X and an Intel Skylake. Going back to 27.5.1 (as described in https://github.com/moby/moby/issues/49513#issuecomment-2724755052 ) only fixes it if you’re using an older binary – rebuilding 27.5.1 with go 1.24 results in the exact same failure we’re seeing in 28.0.0/28.0.1. (It’s just not commonly observed because 27.5.1 was released before go 1.24, so few people have been building 27.5.1 with go 1.24)

Also reported in docker/cli by @partizanna with the Arch Linux packages (built with go1.24); https://github.com/docker/cli/issues/5898

Ticket in the Arch issue tracker; https://bbs.archlinux.org/viewtopic.php?id=303943

docker version / info

Client:
 Version:           28.0.0
 API version:       1.48
 Go version:        go1.24.0
 Git commit:        f9ced58158
 Built:             Mon Feb 24 21:55:48 2025
 OS/Arch:           linux/amd64
 Context:           default

Server:
 Engine:
  Version:          28.0.0
  API version:      1.48 (minimum version 1.24)
  Go version:       go1.24.0
  Git commit:       af898abe44
  Built:            Mon Feb 24 21:55:48 2025
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          v2.0.2
  GitCommit:        c507a0257ea6462fbd6f5ba4f5c74facb04021f4.m
 runc:
  Version:          1.2.5
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
Client:
 Version:    28.0.0
 Context:    default
 Debug Mode: false
 Plugins:
  compose: Docker Compose (Docker Inc.)
    Version:  2.33.1
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 53
  Running: 52
  Paused: 0
  Stopped: 1
 Images: 68
 Server Version: 28.0.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
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: c507a0257ea6462fbd6f5ba4f5c74facb04021f4.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.12.17-1-lts
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 31.25GiB
 Name: serv
 ID: ***************************************
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: ********
 Experimental: true
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Daemon logs from the crash;

mar 06 07:25:25 serv systemd-coredump[2730946]: Process 2707877 (dockerd) of user 0 terminated abnormally with signal 11/SEGV, processing.>
mar 06 07:25:25 serv systemd[1]: Started Process Core Dump (PID 2730946/UID 0).
mar 06 07:25:27 serv systemd-coredump[2730947]: [🡕] Process 2707877 (dockerd) of user 0 dumped core.
                                                
                                                Stack trace of thread 2728044:
                                                #0  0x000063638a94c098 n/a (n/a + 0x0)
                                                #1  0x000063638a9ab419 n/a (n/a + 0x0)
                                                #2  0x000063638a9b0869 n/a (n/a + 0x0)
                                                #3  0x000063638a9a7d56 n/a (n/a + 0x0)
                                                #4  0x000063638a97b625 n/a (n/a + 0x0)
                                                #5  0x000063638a97b2df n/a (n/a + 0x0)
                                                ELF object binary architecture: AMD x86-64
mar 06 07:25:27 serv systemd[1]: systemd-coredump@7-2730946-0.service: Deactivated successfully.
mar 06 07:25:27 serv systemd[1]: systemd-coredump@7-2730946-0.service: Consumed 1.557s CPU time, 853.4M memory peak.
mar 06 07:25:27 serv systemd[1]: docker.service: Main process exited, code=dumped, status=11/SEGV
mar 06 07:25:27 serv systemd[1]: docker.service: Failed with result 'core-dump'.
mar 06 07:25:27 serv systemd[1]: docker.service: Consumed 1min 4.353s CPU time, 4.2G memory peak.
mar 06 07:25:29 serv systemd[1]: docker.service: Scheduled restart job, restart counter is at 2.
mar 06 07:25:29 serv systemd[1]: Starting Docker Application Container Engine...

Is there a hint (apart from the packages existing in e.g. arch linux) whether it’s safe to upgrade to Docker 1.28 on amd64? As far as I understand the comments there were some users who still experienced the EOF?

go-2:1.24.1-1-aarch64 means it’s not rebuilt. So this is not an upstream issue per se.

It wouldn’t shock me if that vdso change by itself made this “possible but rare” and then golang/go@8678196 (that your git bisect hit) made it “possible and common” since it further changed some of the parameters relevant to when growslice would get called (mildly-educated guess, take with salt).

I’ve just managed to reproduce it with Docker against eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13 (seems it was very rare here utilising Docker pulls as the reproduction, however, there could be other influences in play like what @Doridan has suggested).

Updated the bisect below, I’ll close this off by testing both with Docker and the minimal repro from here on.

git bisect start
# status: waiting for both good and bad commits
# bad: [3901409b5d0fb7c85a3e6730a59943cc93b2835c] [release-branch.go1.24] go1.24.0
git bisect bad 3901409b5d0fb7c85a3e6730a59943cc93b2835c
# good: [6885bad7dd86880be6929c02085e5c7a67ff2887] [release-branch.go1.23] go1.23.0
git bisect good 6885bad7dd86880be6929c02085e5c7a67ff2887
# good: [5e8a7316658c2f300a375041b6e0a606fec4c5f2] README: fix CC BY license name
git bisect good 5e8a7316658c2f300a375041b6e0a606fec4c5f2
# bad: [87a89fa45130d4406fa4d9f0882b9c5014240d03] runtime: add the checkPtraceScope to skip certain tests
git bisect bad 87a89fa45130d4406fa4d9f0882b9c5014240d03
# good: [1b5ae45181ef5274045b9b93ae0603ebb34fa811] os/user: User.GroupIds shouldn't error on users with no groups
git bisect good 1b5ae45181ef5274045b9b93ae0603ebb34fa811
# good: [ba42120723a8bb4161c4f54c93f7ab3234923473] runtime: properly compute whether PC is inside vDSO pages
git bisect good ba42120723a8bb4161c4f54c93f7ab3234923473
# bad: [0733682e5ff4cd294f5eccb31cbe87a543147bc6] internal/runtime/maps: initial swiss table map implementation
git bisect bad 0733682e5ff4cd294f5eccb31cbe87a543147bc6
# bad: [e86982c515ba4a494fb1f8e1367f4238a2b59c2e] encoding/json: add omitzero option
git bisect bad e86982c515ba4a494fb1f8e1367f4238a2b59c2e
# bad: [6536c207c2309da7c1c21e3669f8ddf491e31f5b] net: improve GODEBUG=netdns=1 debug messages
git bisect bad 6536c207c2309da7c1c21e3669f8ddf491e31f5b
# good: [5fe3b31cf898de6fbc4f8ac524e16238a9a85e66] go/types, types2: remove dependency on Scope.Contains in resolver
git bisect good 5fe3b31cf898de6fbc4f8ac524e16238a9a85e66
# good: [6ad3933e285b036137a339f598f00a21578fcbfb] go/types, types2: move go/types-only Scope methods into scopes2.go
git bisect good 6ad3933e285b036137a339f598f00a21578fcbfb
# bad: [eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13] runtime: use vDSO for getrandom() on linux
git bisect bad eb6f2c24cd17c0ca1df7e343f8d9187eef7d6e13

@nightah I took a look at the stack trace you posted earlier along with some other ones that looked similar and traced through the go runtime code, think I managed to find a simple repro of this out of docker/dagger:

…

On an x86 Arch Linux latest ec2 AMI (Linux ip-172-31-34-47 6.13.8-1-ec2 #1 SMP PREEMPT_DYNAMIC Mon, 24 Mar 2025 21:00:24 +0000 x86_64 GNU/Linux) running that binary will segfault after ~5ish seconds.

For me it seems the highest frequency of crashes on my own machines is with taskset -c 0,1 (so limiting the process to 2 cores). Running it on all cores so far has not crashed. Running it on a single core (taskset -c 0) has also crashed, but seems to take longer to happen and sometimes I get fatal error: thread exhaustion before it can crash.

Might help others trying to repro, or not. I am running Arch with either the latest zen or LTS kernel (6.14 vs 6.12). This version differnece seems to have no impact on the crashes or their frequency.

@thaJeztah

Mine crashes when building images, it is not very deterministic but generally more than 15-20 steps. I can’t get any of our builds to complete if --no-cache is in use.

Interestingly this Dockerfile also causes the crash podman build --no-cache .

Dockerfile

FROM ubuntu:24.04

RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true RUN find / -ls || true

so maybe the volume of console output affects it or the number of allocations/deallocations…

Should us users ask package maintainers to not compile docker using go1.24.

Good idea. I opened an issue here for Alpine.

I tried doing it on a real hardware (i.e. not in QEMU) today. Still unable to repro. 😩 The system is x86_64 laptop (i7-8565U) running Fedora 41, kernel 6.13.7-200.fc41.x86_64 (seems very similar to latest Arch kernel).

I considered if chipset could have something to do with it, but I’m not sure.

I have two servers where it occurs, both running Intel chips, so I don’t think it’s directly vendor related. An Intel Xeon E5-2690 and Intel Core i5-6500. My third server that has the issue is virtual, running under a Haswell-compatible VCPU. I installed Docker on my desktop running Arch with an AMD 7800X3D, and it still happens there.

Otherwise, I have not yet been in a situation where I can’t reproduce this bug. It’s incredibly curious you can’t.

The chipset and hardware are most likely unrelated to this issue. I have been able to reproduce this problem on both an ESXi 6.5 host with E5-2680V2 and an Arch Linux guest running on a Proxmox VE host with Intel N100. Additionally, this issue can also be reproduced on Arch Linux physical machines with AMD Ryzen 5 5560U and Ryzen 7 7840HS processors.

@kolyshkin I think ./hack/make.sh binary builds a static binary (dynbinary would be dynamically linked); would that be relevant?

Probably not; I ran similar tests with a dynamic binary earlier.

But just to confirm, I’ve built a dynbinary and ran the pulls 3 times. Still unable to reproduce :-\

@cpuguy83 Ah sorry I forgot about that. Since this is the Arch package, I pulled the debuginfo using debuginfod-find: dockerd-debuginfo.tar.gz

If I need to do something else let me know.

I have this issue on Arch linux, 6.12.17-1-lts kernel, Docker version 28.0.0, build f9ced58158

Pulling Immich server image causes EOF error and takes out my whole docker daemon including 2 other stacks. Full discussion here: https://github.com/immich-app/immich/discussions/16648

Yeah, I briefly mentioned this ticket on a different go1.24 regression (that one got fixed, after a git bisect found the offending commit); https://github.com/golang/go/issues/71932#issuecomment-2682230130

Directly related, no. This issue is arm64 only. However, this kind of bug, making an invalid pointer mid-pointer-arithmetic, has happened before (e.g. CL 225798), and I would not be terribly surprised if there’s a similar bug lurking in amd64 (or other archs) somewhere.

This one is probably harder to git-bisect given that the issue not consistently reproduces (or at least would likely take longer to bisect)

@xAt0mZ debug symbols need to be downloaded with debuginfod to allow gdb provides symbols in backtraces.

Besides, when docker daemon (dockerd) segfaulted, seems the containerd terminates all running containers and manual restarting is required after docker daemon goes back online.