Repository navigation
fix(events): treat io.EOF as a normal end of a bounded stream - #14444
Merged
Merged
Conversation
The Engine client sends io.EOF over EventsResult.Err once the stream has been read completely, which is what happens when `events --until` reaches its deadline. Service.Events returned that error verbatim, so the command printed "EOF" and exited 1 even though every event had been delivered. Return nil for io.EOF and keep propagating real stream errors. Signed-off-by: Zhuoming Wang <zhuomingwang0901@outlook.com>
Bruce848647703
force-pushed
the
fix/events-eof-exit-code
branch
from
November 3, 2026 12:49
45a8d01 to
1266c2a
Compare
ndeloof
previously approved these changes
Nov 3, 2026
ndeloof
left a comment
Contributor
There was a problem hiding this comment.
LGTM. The fix is correct: the moby client sends io.EOF on EventsResult.Err once the stream is fully read (the Messages channel is unbuffered, so no event can be dropped before it), genuine errors such as io.ErrUnexpectedEOF are still propagated, and this matches docker events.
Only blocker before merge: validate (lint) fails because forbidigo rejects context.Background() in tests (events_test.go:45 and :64). Please use t.Context() instead.
forbidigo rejects context.Background() in tests; t.Context() is the intended replacement and carries the test's cancellation. Signed-off-by: Zhuoming Wang <zhuomingwang0901@outlook.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ndeloof
approved these changes
Nov 3, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14442.
Problem
The Engine client sends
io.EOFoverEventsResult.Erronce a stream has been read completely, which is exactly what happens whenevents --untilreaches its deadline:Service.Eventsreturned that error verbatim, soplugin.RunprintedEOFand exited 1 even though every matching event had already been delivered.docker eventsin docker/cli treats the sameio.EOFas success.Change
Return
nilwhen the stream ends withio.EOF, and keep propagating genuine stream errors.Tests
Added
internal/inspect/events_test.go:io.EOFcompletes without an errorThe unit tests drive
Service.Eventsthrough the generatedMockAPIClient; no Docker daemon is required.