Skip to content

Reboot crossing watchdog timeout#2939

Open
pasinskim wants to merge 3 commits into
masterfrom
reboot-crossing-watchdog-timeout
Open

Reboot crossing watchdog timeout#2939
pasinskim wants to merge 3 commits into
masterfrom
reboot-crossing-watchdog-timeout

Conversation

@pasinskim

Copy link
Copy Markdown
Member

Fix the race condition with client reboots inside the integration tests.

pasinskim and others added 3 commits June 26, 2026 09:26
…ent watchdog

A deployment that crosses a reboot only reaches its terminal status after the
client's automatic system-reboot watchdog: mender-update waits a hardcoded
chrono::minutes(10) (update_module_call.cpp, AsyncSystemReboot) for the `reboot`
to take effect before giving up and reporting a terminal status. When that
watchdog is hit, the deployment reaches 'failure' at ~601s.

check_expected_statistics defaulted to a 600s poll window -- an exact dead heat
with that 600s watchdog -- so reboot-crossing failure cases flaked with
"Never found <status>". Bumping to an independent literal (e.g. 900s) only
relocates the race (901 vs 900).

Introduce a single source of truth, CLIENT_AUTOMATIC_REBOOT_WATCHDOG, and a
DERIVED deadline REBOOT_CROSSING_DEPLOYMENT_TIMEOUT (= watchdog * 2). Deriving it
(multiplicatively) means a change to either value can never create a dead heat.
Polling returns the instant the status is observed, so the larger deadline never
slows a passing test; it only bounds a genuinely-stuck deployment.

Also make the timeout self-diagnosing: dump the per-device deployment log and the
observed status progression, and warn explicitly when max_wait <= the watchdog.
The failure now shows the reboot / "Version file error" / watchdog gap directly,
without pulling artifacts.

Changelog: None
Signed-off-by: pasinskim <marcin.pasinski@northern.tech>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…crossing failures

The reboot-crossing failure cases (Failure_in_ArtifactCommit_* and the
Corrupted_script_version_* sets) drive the client through an automatic system
reboot; the deployment only reaches 'failure' after the client's 10-minute
reboot watchdog. The default 600s check_expected_statistics window was an exact
dead heat with that watchdog, so these cases flaked intermittently with
"Never found failure ... after 600 seconds".

Use REBOOT_CROSSING_DEPLOYMENT_TIMEOUT (derived from the client watchdog) instead
of the default. This supersedes the bare max_wait=15*60 approach: the value is a
function of the watchdog, so it cannot drift back into a dead heat, and on
timeout the failure now dumps the device deployment log (the reboot / "Version
file error" / watchdog gap) directly.

Changelog: None
Signed-off-by: pasinskim <marcin.pasinski@northern.tech>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t waits

verify_reboot_performed() and the post-reboot check_expected_statistics() calls
defaulted to a 600s window -- an exact dead heat with the client's 600s
automatic-reboot watchdog. When a reboot is slow to take effect the device
recovers at ~601s, one second after the wait gives up, producing flaky
"Device never rebooted" / "Never found <status>" failures.

Use REBOOT_CROSSING_DEPLOYMENT_TIMEOUT (derived from the client watchdog) for the
reboot-crossing waits. verify_reboot_not_performed() (the intentional short
"confirm no reboot" checks) are left untouched.

Changelog: None
Signed-off-by: pasinskim <marcin.pasinski@northern.tech>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mender-test-bot

Copy link
Copy Markdown
Contributor

@pasinskim, start a full integration test pipeline with:

  • mentioning me and start integration pipeline

my commands and options

You can prevent me from automatically starting CI pipelines:

  • if your pull request title starts with "[NoCI] ..."

You can trigger a client pipeline on multiple prs with:

  • mentioning me and start client pipeline --pr mender/127 --pr mender-connect/255

You can trigger a client pipeline for a specific Mender Client release with:

  • mentioning me and start client pipeline --release 6.0.x (can be given multiple times)
  • by default, a pipeline is triggered for each supported release the component is a part of

You can trigger GitHub->GitLab branch sync with:

  • mentioning me and sync

You can print PR statistics for a repository with:

  • mentioning me and print fast pr stats (Team stats only)
  • mentioning me and print full pr stats (Detailed report)
  • options: --repo <repo>, --team <name>, --all-repos, --exclude-drafts, --exclude-user <user>
  • mentioning me and print full pr stats --repo mender --all-repos --exclude-drafts

You can cherry pick to a given branch or branches with:

  • mentioning me and:
 cherry-pick to:
 * 1.0.x
 * 2.0.x

@pasinskim

Copy link
Copy Markdown
Member Author

@mender-test-bot start integration pipeline

@mender-test-bot

Copy link
Copy Markdown
Contributor

Hello 😺 I created a pipeline for you here: Pipeline-2631163881

Build Configuration Matrix

Key Value
INTEGRATION_REV pull/2939/head
RUN_TESTS_FULL_INTEGRATION true

deploy.check_expected_statistics(deployment_id, "failure", 1)
reboot.verify_reboot_performed(max_wait=REBOOT_CROSSING_DEPLOYMENT_TIMEOUT) # since the network is broken, two reboots will be performed, and the last one will be detected
deploy.check_expected_statistics(
deployment_id, "failure", 1, max_wait=REBOOT_CROSSING_DEPLOYMENT_TIMEOUT

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.

won't we as a result wait 2*REBOOT_CROSSING_DEPLOYMENT_TIMEOUT? Once in verify_reboot_performed and a second time in check_expected_statistics?

I think there's no reason to wait for statistics this long.

logger.info("Network stabilized")
reboot.verify_reboot_performed()
deploy.check_expected_statistics(deployment_id, "success", 1)
reboot.verify_reboot_performed(max_wait=REBOOT_CROSSING_DEPLOYMENT_TIMEOUT)

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.

I'm not sure I understand the reasoning here. If we wait here for the deployment to finish (successfully), then why would we need to wait for the client watchdog to kill mender-update? If it happens, then there would be no successfully deployment AFAIK.

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.

4 participants