Skip to content

docs(compose): correct what the startMx comment says about #12846 - #14399

Merged
ndeloof merged 2 commits into
docker:mainfrom
ndeloof:chore/fix-startmx-comment
Oct 27, 2026
Merged

ndeloof merged 2 commits into
docker:mainfrom
ndeloof:chore/fix-startmx-comment

Conversation

@ndeloof

@ndeloof ndeloof commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

What this PR does, in one sentence

Corrects the comment of startMx, which blamed #12846 on concurrent container starts, and one test comment that described a special case the start path no longer has — comments only, no code.

Context

The comment of startMx says that, with Engine 28.0 to 28.2, "containers started concurrently could be assigned the same published host port". That is not what #12846 was: a container with several random published ports, one on 0.0.0.0 and one on a specific address, could be given the same host port twice, a flaw of the daemon's port allocator fixed in Engine 28.3.0 (moby/moby#50054). As noted on the issue, it was not a race between starts, so the mutex added as a workaround by #12851 was unlikely to help. The sequential start of a service's replicas, which #8530 (a port range shared by the replicas) needed and #10067 introduced, is a different thing, and today it is the plan's replica chain, not this mutex.

The comment of TestPlanStart_ProviderPathEnrichesStaleNonRelayContainer says the start path "only special-cases Provider != nil for the zero-containers case". planServiceStart actually routes every provider to planProviderStart, and the bare-vs-enriched start is decided per container.

What the PR brings

  • The startMx comment states what the mutex is — a workaround for a daemon flaw that has been fixed — what it does not provide (the replica ordering, which comes from the plan), which paths take it (the plan executor, a relay restarted by a start plan included) and which do not (restart, run, the deployment of the relay, the hook runners). The TODO to remove it once Engine 28.x is out of support and the paragraph on why it is a package variable are kept, the latter reworded now that no race is claimed.
  • The test comment says that an existing non-relay container of a provider-backed service is started like any ordinary replica, and names isReplicaRelay, which is what gates pre_start.

Why this is no functional change

  • Every added or removed line of the diff is a // comment line.
  • The token stream of each of the 394 Go files of pkg/, cmd/ and internal/, comments excluded, is identical before and after.
  • Binaries built from main and from this branch have identical symbol tables (names, sizes, types).
  • go vet, gofmt, the linter (only the known findings) and go test ./pkg/compose/ -race pass.

Part of #14081 (Lot 3).

🤖 Generated with Claude Code

docker#12846 was not a race between container starts but a flaw of
the daemon's port allocator, fixed in Engine 28.3.0: the mutex added as its
workaround could not help, and the comment said the opposite. Say what the
mutex does and does not provide, and that the sequential start of a
service's replicas (docker#8530) is the plan's replica chain, not this mutex.

Also fix the comment of the test of a stale non-relay container of a
provider-backed service, which still described a special case the start
path no longer has: planServiceStart routes every provider to
planProviderStart, which decides bare-vs-enriched per container.

Comments only: the token stream of every Go file, comments excluded, is
unchanged.

Part of docker#14081

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
…eview

Say that a relay restarted by a start plan does take startMx while the
deployment of the relay does not, that the lock was unlikely (rather than
unable) to help against docker#12846, and name isReplicaRelay, which is what
gates pre_start. Rewrap the test comment.

Comments only.

Part of docker#14081

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
@ndeloof
ndeloof requested review from a team as code owners October 27, 2026 10:29

@docker-agent docker-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

@codecov

codecov Bot commented Oct 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ndeloof
ndeloof merged commit f5f573b into docker:main Oct 27, 2026
63 of 65 checks passed
@ndeloof
ndeloof deleted the chore/fix-startmx-comment branch October 27, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants