[BUG] up: an optional (required: false) service_healthy dependent is not started when a required dependent shares the failing wait
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 58/100
調査の方向性
Start by tracing how the start phase handles the shared service_healthy wait and how abortReason decides whether each dependent is blocked; the issue points to the plan engine change in #14081 and a possible connection to #14311. Reproduce with the supplied compose file and up -d db needs_db optional_db, then compare with a run that leaves out needs_db. Done when the required dependent fails while optional_db starts with the optional dependency warning.
索引モデルが issue の本文から書いたものです。
説明
Description
With v5.7.1, up does not start a service whose service_healthy dependency is optional (required: false) when another service in the same run depends on that dependency as required and the dependency turns unhealthy. The optional dependent is given up together with the required one, with the event:
not started: condition "service_healthy" of service "db" not met
When the required dependent is not part of the run, the same optional dependent is started as expected (with the optional dependency "db" failed to start warning). So whether an optional dependent starts depends on whether some other service needs the same dependency as required.
v5.6.0 starts the optional dependent in both cases.
Steps to reproduce
A compose file along these lines (a dependency whose healthcheck always fails, one required and one optional service_healthy dependent):
services:
db:
image: busybox
command: sleep infinity
healthcheck:
test: ["CMD-SHELL", "exit 1"]
interval: 2s
timeout: 3s
retries: 1
needs_db:
image: busybox
command: sleep infinity
depends_on:
db:
condition: service_healthy
optional_db:
image: busybox
command: sleep infinity
depends_on:
db:
condition: service_healthy
required: false
Then up -d db needs_db optional_db.
Expected
needs_db fails (its required condition is not met); optional_db is started anyway, with the optional-dependency warning, as v5.6.0 does:
Container db Error dependency db failed to start
Container db Skipped: optional dependency "db" failed to start
level=warning msg="optional dependency \"db\" failed to start: container db is unhealthy"
Container optional_db Started
dependency failed to start: container db is unhealthy
Actual (v5.7.1)
optional_db is not started; its row gets not started: condition "service_healthy" of service "db" not met. With needs_db left out of the run, optional_db starts.
Notes
From reading the code, the service_healthy wait on db looks like a single plan node shared by both dependents. When it fails (with required semantics, for needs_db), it cancels the phase, and abortReason reports optional_db as held by "the very wait that failed" (unmetCondition(...) + " not met"), although for optional_db that wait should not block its start. This seems to have come with the start phase moving into the plan engine (#14081). Possibly related to #14311 (start -p treating an optional dependency as required).
Versions
- Seen with the Go SDK
github.com/docker/compose/v5v5.7.1, callingUp(the reproduction above was run through an application embedding it, with real images rather than busybox; the file above is the minimal equivalent). - The
docker composeCLI v5.6.0 on the same host and project starts the optional dependent. - Not tried with the v5.7.1 CLI binary.
- Docker Engine on Linux.
- 主要言語
- Go
- スター
- 38.9k
- フォーク
- 6k
- 平均マージ
- 2日 22時間
- マージ済み PR(30日)
- 81
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
docker/compose のほかの issue
-
[BUG] `docker compose port` prints `:0` (exit 0) for a port the image exposes but the service does not publish対応中かも @ndeloof が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
docker/compose#14435 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] deploy.restart_policy without condition drops the restart policy再び着手できるかも @akshat-lakhera が 25 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
docker/compose#14383 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] Negative replica count in scale flags (docker compose scale / --scale) is accepted without validation対応中かも @arsalanyavari が 8 日前に担当しました。 オープンkind/bug status/approved
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
-
[BUG] pre_stop hooks are skipped when up or scale stops a container対応中かも @htoyoda18 が 11 日前に担当しました。 オープンkind/bug status/approved
難易度 4/5 3〜5日 初心者へのやさしさ 53/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
fluxcd/notification-controller#1441 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
volcengine/volcengine-go-sdk#163 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
OneBusAway/maglev#2145 ·
メンテナーはふだん 2 日以内に返信
-
priority/medium status/ready type/chore
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
discobox-ai/discobox#1357 ·
メンテナーはふだん 1 日以内に返信