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
- “docker pull” a container, preferrable one with many layers
- 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)
Upstream issue: https://github.com/golang/go/issues/73141
So I’ve gone ahead and bisected from Go 1.23.0 to 1.24.0, below are the results:
With the culprit identified being this commit:
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
gopackage and rebuilddockerin 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:
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:
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:
runtime.LockOSThreadstuff. 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 seeminglyI 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
86781963cc2bf0d3dbd1eccebd8a2f080846f3eereverted.Going back and reconfirming directly against
86781963cc2bf0d3dbd1eccebd8a2f080846f3eeand327074551a2f22f2c0b8e444d1673c86f77ca745as 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
86781963cc2bf0d3dbd1eccebd8a2f080846f3eeand327074551a2f22f2c0b8e444d1673c86f77ca745are not the last bad/good commits, apologies for the false alarm.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.
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.
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=noswissmapandGOEXPERIMENT=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/sysas I couldn’t get the minimal repro to build with Go<1.24 due to a build constraint specifically for Go >=1.24 on thevgetrandomcall.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:
@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.
I’ll try with your minimal reproduction too, though here’s where I’m at so far with two more bisect steps to go:
@nightah, just to be clear, the variable name is
GOEXPERIMENT, notGOO...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
I tried building the Arch Linux package with
GOOEXPERIMENT=noswissmap,nospinbitmutexwith 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
Daemon logs from the crash;
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 theEOF?go-2:1.24.1-1-aarch64means it’s not rebuilt. So this is not an upstream issue per se.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.
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 getfatal error: thread exhaustionbefore 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-cacheis 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…
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.
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
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
debuginfodto allow gdb provides symbols in backtraces.Besides, when docker daemon (
dockerd) segfaulted, seems thecontainerdterminates all running containers and manual restarting is required after docker daemon goes back online.