You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "M4n5ter (via GitHub)" <gi...@apache.org> on 2026/08/27 14:21:48 UTC

[I] test(runtime-host): generation-mismatch test races starting and recovering states [maka]

M4n5ter opened a new issue, #4028:
URL: https://github.com/apache/maka/issues/4028

   <details open>
   <summary>English</summary>
   
   ## What happened
   
   The Runtime Host test `does not take over a generation-mismatched Host before it is ready` is flaky under load. The takeover remains correctly non-restartable, but the test sometimes observes the registered Host in `starting` instead of the exact `recovering` state it asserts:
   
   ```text
   AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
   + actual - expected
   + 'starting'
   - 'recovering'
   ```
   
   Observed in the required CI job for an unrelated Desktop release PR:
   
   - https://github.com/apache/maka/actions/runs/33079167623/job/98541408008
   - head: `24503ffd5ea2b8fc5bf3efacbbb4394d7050fe82`
   - result: 1278 passed, 1 failed, 9 skipped
   
   That PR does not modify `packages/runtime-host` or this test. The same test was also reported as load-sensitive in https://github.com/apache/maka/issues/3840#issuecomment-5419850473 and noted as a pre-existing Windows failure in #3844, but neither #3840 nor #3844 tracks or fixes this state race.
   
   ## How to reproduce
   
   ```sh
   npm --workspace @maka/runtime-host run build
   node --test \
     --test-name-pattern='does not take over a generation-mismatched Host before it is ready' \
     packages/runtime-host/dist/__tests__/host-kernel.test.js
   ```
   
   Run the test while the machine is loaded or while other workspace suites execute concurrently. It may pass repeatedly on an idle machine; 30 focused repetitions passed locally, while loaded macOS runs previously reproduced it 3 out of 4 times and the linked GitHub-hosted Linux run reproduced it once.
   
   ## Environment
   
   - Maka commit: `24503ffd5ea2b8fc5bf3efacbbb4394d7050fe82`
   - OS: GitHub-hosted `ubuntu-latest`
   - Surface: Runtime Host tests
   - Node.js: 24
   
   ## Root cause
   
   The test starts `RuntimeHostKernel.start()` and immediately polls `connectRuntimeHost()` only while the result is `not_registered`. Registration makes the `starting` handshake observable before the asynchronous composition reaches `recover()`. The first registered response can therefore legitimately be either `starting` or `recovering`.
   
   The production invariant under test remains satisfied in the failure: the result is `upgrade_required` and `restartable` is `false`. Only the test's unsynchronized exact-state assertion fails.
   
   The deterministic fix is to add an explicit `recoveryEntered` barrier signalled at the beginning of the test composition's `recover()` hook, await that barrier before connecting, and retain the exact `recovering` assertion. Accepting either state would weaken the intended phase-specific test.
   
   </details>
   
   <details>
   <summary>中文</summary>
   
   ## 问题
   
   Runtime Host 测试 `does not take over a generation-mismatched Host before it is ready` 在高负载下会偶发失败。takeover 仍被正确判定为不可重启,但测试有时在 Host 注册后观察到 `starting`,而不是断言要求的精确 `recovering` 状态:
   
   ```text
   AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
   + actual - expected
   + 'starting'
   - 'recovering'
   ```
   
   本次出现在一个与 Runtime Host 无关的 Desktop release PR 的 required CI 中:
   
   - https://github.com/apache/maka/actions/runs/33079167623/job/98541408008
   - head:`24503ffd5ea2b8fc5bf3efacbbb4394d7050fe82`
   - 结果:1278 passed、1 failed、9 skipped
   
   该 PR 没有修改 `packages/runtime-host` 或这个测试。同一测试的负载敏感性也记录在 https://github.com/apache/maka/issues/3840#issuecomment-5419850473,#3844 还记录了既有 Windows 失败,但 #3840/#3844 均未跟踪或修复这个状态竞态。
   
   ## 复现方式
   
   ```sh
   npm --workspace @maka/runtime-host run build
   node --test \
     --test-name-pattern='does not take over a generation-mismatched Host before it is ready' \
     packages/runtime-host/dist/__tests__/host-kernel.test.js
   ```
   
   在机器高负载或其他 workspace suites 并发执行时运行。空闲机器上可能连续通过:本地定向重复 30 次均通过;既有高负载 macOS 记录为 4 次中复现 3 次,本次 GitHub-hosted Linux run 复现 1 次。
   
   ## 环境
   
   - Maka commit:`24503ffd5ea2b8fc5bf3efacbbb4394d7050fe82`
   - OS:GitHub-hosted `ubuntu-latest`
   - Surface:Runtime Host tests
   - Node.js:24
   
   ## 根因
   
   测试启动 `RuntimeHostKernel.start()` 后立即轮询 `connectRuntimeHost()`,并且只在返回 `not_registered` 时继续等待。Host 注册后、异步 composition 进入 `recover()` 前,`starting` handshake 已经可以被读取,因此第一个已注册响应可以合法地处于 `starting` 或 `recovering`。
   
   失败时生产不变量仍然成立:结果为 `upgrade_required`,且 `restartable` 为 `false`。失败的是测试中没有同步的精确状态断言。
   
   确定性修复应在测试 composition 的 `recover()` 开始处发出显式 `recoveryEntered` 信号,连接前等待该 barrier,再保留对精确 `recovering` 状态的断言。直接接受两个状态会削弱这个阶段性测试。
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org


Re: [I] test(runtime-host): generation-mismatch test races starting and recovering states [maka]

Posted by "M4n5ter (via GitHub)" <gi...@apache.org>.
M4n5ter closed issue #4028: test(runtime-host): generation-mismatch test races starting and recovering states
URL: https://github.com/apache/maka/issues/4028


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org