Repository navigation
test(gateway): find the child's listen marker after libtest's test-name prefix - #2667
Merged
zhanghuidinah merged 1 commit intoNov 16, 2026
Conversation
…me prefix With one test thread, libtest prints "test <name> ... " without a newline before the test body runs, so the child's "LISTEN <addr>" line arrives as "test shutdown::tests::stalled_process_child ... LISTEN <addr>". The parent matched the marker as a line prefix, never saw it, and timed out after 5 s. GitHub-hosted runners have several CPUs and passed; the self-hosted runner used for master pushes and the nightly runs one test thread, so both default-watchdog tests failed there on every run since oceanbase#2538. Pin the child to --test-threads=1 so every host produces the same output, and match the marker anywhere in the line.
Fengzdadi
requested review from
AlexStocks,
PsiACE and
frostming
as code owners
November 16, 2026 05:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue or RFC does this PR close?
No issue is filed. This fixes the
gateway-validation / checkfailure on master since #2538 (push runs 43678871410 and 43735852108, nightly runs 43646075459 and 43770083890).Rationale for this change
shutdown::tests::default_watchdog_exits_when_request_runtime_cannot_yieldandshutdown::tests::default_watchdog_remains_armed_through_runtime_shutdownfail in every master push and nightly run of this job since #2538. Both panic atcrates/pc-gateway-app/src/shutdown.rs:342:68withcalled Result::unwrap() on an Err value: Timeout, while waiting for the child'sLISTEN <addr>line.The tests re-run the test binary as a child (
--exact shutdown::tests::stalled_process_child --nocapture) and read its stdout line by line. When libtest runs with one test thread, it printstest <name> ...without a newline before the test body runs. The child's first marker then arrives as:The parent matched the marker with
strip_prefix("LISTEN "), so it never saw it and timed out after 5 s. With several test threads, libtest prints the test name only after the test finishes, andLISTENstarts its own line.Master pushes and the nightly run this job on the self-hosted
powercontext-ci-lightrunner, which runs libtest with one test thread. Two things show it: the two failures were reported 5 s apart, and the binary's run took 12.06 s in total, so the tests ran one after the other. Fork pull requests, including #2538, run on GitHub-hostedubuntu-24.04runners, which have several CPUs, so the tests passed there in 30.12 s with both running at once. The workflow does not setRUST_TEST_THREADS. The single thread most likely comes from the runner exposing one CPU, but that was not observed on the runner.What changes are included in this PR?
Test-only, in
gateway/crates/pc-gateway-app/src/shutdown.rs:LISTENanywhere in the line (split_once) instead of at its start. The only stdout before the marker is a blank line,running 1 test, and libtest'stest <name> ...prefix, and none of them containsLISTEN.--test-threads=1, so its output is the same on every host and every run takes the path the self-hosted runner takes. A regression to prefix matching then fails on any machine.STALLEDandOWNERS_JOINEDare unchanged. They are printed afterLISTEN's newline, so they always start their own lines. The timing assertions and the injected faults are unchanged.Are there any user-facing changes?
No.
How was this change tested?
On macOS with 18 CPUs and Rust 1.99.1 (CI pins 1.95.0), against upstream/master
303b32cc0:RUST_TEST_THREADS=1 cargo test --locked --offline -p pc-gateway-app --bin pc-gateway shutdown::tests::default_watchdogfails both tests atshutdown.rs:342:68withTimeout, as in CI. Without the variable, both pass.RUST_TEST_THREADS=1the marker shares thetest ...line, and with 4 threads it is on its own line.--test-threads=1pin (prefix matching kept), both tests fail on this multi-CPU host. With the full change:cargo test --locked --offline -p pc-gateway-app --bin pc-gateway shutdown::tests: 5 passed (30.0 s).RUST_TEST_THREADS=1: 5 passed (60.0 s). Both watchdog kinds exited with status 1 after about 30.008 s, inside the 29.99–32 s window.cargo test --locked --offline --workspacefromgateway/passed on this host.cargo fmt --all --checkandcargo clippy --locked --offline --all-targets -- -D warningspassed.Self-review against
REVIEW.mdand an independent Opus review of the diff found no blocking defect, no false marker match, and no effect on the timing assertions.The fix was not run on the self-hosted runner. The CI run on this PR uses a GitHub-hosted runner unless it comes from a branch of oceanbase/powercontext.
AI usage statement
This change was written by Claude Code (Claude Opus 5.5). Claude Code traced the failure from the CI logs, reproduced it locally, ran the checks listed above, had the diff reviewed by an independent Claude Code agent, and wrote this description.