Skip to content

orchestrator: respect task stop grace period in stop-first updates (#3274) - #3298

Open
adilalperenciftci wants to merge 1 commit into
moby:masterfrom
adilalperenciftci:3274-stop-first-grace-period
Open

adilalperenciftci wants to merge 1 commit into
moby:masterfrom
adilalperenciftci:3274-stop-first-grace-period

Conversation

@adilalperenciftci

Copy link
Copy Markdown

when updating a service with stop-first order, DelayStart was waiting for
r.TaskTimeout (default 1m) to give up on the old task. if the old task
had a StopGracePeriod longer then 1 minute, the timer expired while the old
container was still shutting down and relased the replacement task, causing
both containers to run at the same time and violating stop-first.

this was a regression from 47ddece where service paramater was removed from
DelayStart. since StopGracePeriod is inside oldTask.Spec.GetContainer(), we can
read it directly from oldTask and use max(TaskTimeout, grace + 5s buffer)
so we wait for the container to actually stop before starting the new one.

fixes #3274

…oby#3274)

when doing a stop-first service update, DelayStart was waiting on
r.TaskTimeout (defaults to 1m) to give up on the old task. if the
container had a StopGracePeriod longer then 1m, this timer expired while
the old container was still shutting down and relased the new task
too early, so both containers ended up running at the same time.

this was a regression from 47ddece where service wasn't passed to DelayStart
anymore. but since StopGracePeriod is already in oldTask.Spec, we can just
read it directly from the container spec without needing the service object,
and use max(TaskTimeout, grace + 5s buffer).

fixes moby#3274

Signed-off-by: ADİL ALPEREN ÇİFTCİ <134228585+adilalperenciftci@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 24, 2026 05:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

A service update using the stop-first update policy does not respect the existing task’s stop grace period when it exceeds one minute.

2 participants