Skip to content

[9.6] [ML] Report hung test batches to Test Analytics and fail them fast - #3285

Closed
edsavage wants to merge 2 commits into
elastic:9.6from
edsavage:ml/test-batch-watchdog-junit-9.6
Closed

edsavage wants to merge 2 commits into
elastic:9.6from
edsavage:ml/test-batch-watchdog-junit-9.6

Conversation

@edsavage

@edsavage edsavage commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Backport of #3283 to 9.6. Draft, opened so the watchdog diagnostics run on this branch's CI while #3283 is still being validated; it is not intended to merge before #3283.

Snapshot builds on 9.5, 9.6 and main (macOS aarch64 and linux-x86_64) have timed out in unrelated multi-threaded tests since 26 Oct (7294 on 9.5, 7310 and 7316 on 9.6, 7361 on main). None of the three hung tests share code, and none occurred between 1 Aug and 25 Oct, so the cause is still unknown. This change makes the next hang show up in Test Analytics, fail in 15 minutes instead of 45, and log stacks, load and open files.

The cmake changes apply unchanged; run_tests.sh differs slightly on 9.5 (no Sandbox2 sections) but the edit applies cleanly. Not yet run on this branch.

🤖 Generated with Claude Code

…lastic#3283)

Backport of elastic#3283 (draft) to collect hang diagnostics on this branch.

A test batch that hangs is killed by CTest after 45 minutes. Boost.Test only
writes its JUnit file on completion, so the killed batch left an empty file,
its cases vanished from the merged results and Test Analytics showed nothing,
even though the build failed.

- Record batches with no complete JUnit file as failed cases before merging.
- Default TEST_TIMEOUT to 900s for non-debug test steps (was 2700s).
- Run batches under a watchdog that dumps thread stacks, machine load and
  open files just before the timeout, so the hang can be diagnosed from the
  log. DYLD_LIBRARY_PATH is restored inside the wrapper because macOS SIP
  strips it when bash starts.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* Recover missing JUnit results only for batches that are expected to write
  them: JUnit logging configured, and not the HRF-only seccomp runner.
* Treat only complete <testcase> elements as results, matched on suite and
  case name, so an interrupted case is still reported as failed.
* Give the watchdog's diagnostics a fixed time budget and kill the batch
  regardless of whether they finish.
* Kill the whole process tree of a timed-out batch, including processes in
  their own process group, and report the timeout through a flag file so the
  exit status does not depend on a signal race.

Backport of the follow-up to elastic#3283.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@edsavage edsavage added backport auto-backport Automatically merge backport PRs when CI passes :ml >test labels Nov 22, 2026
@edsavage

Copy link
Copy Markdown
Contributor Author

Closing in favour of auto-backport from #3283. The changes are identical, and the backport tool will open the 9.6 and 9.5 backports when #3283 merges.

@edsavage edsavage closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically merge backport PRs when CI passes backport :ml >test v9.6.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants