Skip to content

fix(ci): wait for collator RPC before ts client connects#4063

Merged
Kailai-Wang merged 1 commit into
devfrom
fix/ts-test-wait-rpc-ready
Jul 2, 2026
Merged

fix(ci): wait for collator RPC before ts client connects#4063
Kailai-Wang merged 1 commit into
devfrom
fix/ts-test-wait-rpc-ready

Conversation

@Kailai-Wang

Copy link
Copy Markdown
Collaborator

Problem

The release create-release-draft heima ts-test hung for the full 30-min GH-action timeout at wait for parachain to produce block #1 — never printing anything after Connecting to parachain ws://127.0.0.1:9944.

Using the node logs captured by #4062, the node was proven healthy (finalized to #252, zero panics, RPC bound on 0.0.0.0:9944). The stall was entirely client-side: ApiPromise.create() in wait-finalized-block.ts never connected.

Root cause

A startup race. In the release path, build-parachain-client finishes and the docker image loads slowly, so the collator's RPC comes up ~30s after the ts client opens the WS:

  • client connects to ws://127.0.0.1:9944 at 22:33:35
  • collator process starts 22:33:56, RPC listens 22:34:05

When the WS opens before the RPC port is listening, ApiPromise.create() hangs indefinitely — past the script's own 5-min timeout (that timer's cleanup path assumes a live api, so it never actually exits). Confirmed the client itself is fine: polkadot-js 16.5.6 connects to a live stable2512 node in ~0.2s.

Fix

launch-network.sh polls the collator's system_health RPC until it answers (up to ~3 min) before running wait-finalized-block. Test-infra only — no runtime/node change.

Verification

Local stable2512 node via the edited script:

  • collator RPC is ready (after ~24s) — poll detects readiness
  • client then connects and subscribeFinalizedHeads fires (Parachain finalized block #0 ...), where before it hung in ApiPromise.create()

(Local parachain stays at #0 due to an unrelated zombienet core-assignment quirk; the point proven here is that the connect race is gone. In CI the node does finalize, so this unblocks the ts-test.)

The release ts-test could hang for the full 30-min GH-action timeout at
"wait for parachain to produce block #1". Root cause (found via the node logs
captured by the previous fix): the polkadot-js client in wait-finalized-block.ts
opened ws://127.0.0.1:9944 before the collator's RPC was listening — in the
release path, docker image load delays collator startup by ~30s. When the WS
opens before the port is up, ApiPromise.create() hangs indefinitely (past the
script's own 5-min timeout, since that timer's cleanup path assumes a live api).

launch-network.sh now polls the collator's `system_health` RPC until it answers
(up to ~3min) before running wait-finalized-block. Verified locally against a
stable2512 node: the client now connects and its subscribeFinalizedHeads
callback fires (previously it hung in ApiPromise.create()).

Test-infra only; no runtime/node change.
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
heima-aa-demo-app Ignored Ignored Jul 2, 2026 7:08am

Request Review

@Kailai-Wang Kailai-Wang enabled auto-merge (squash) July 2, 2026 07:19
@Kailai-Wang Kailai-Wang merged commit 76ab0fe into dev Jul 2, 2026
15 checks passed
@Kailai-Wang Kailai-Wang deleted the fix/ts-test-wait-rpc-ready branch July 2, 2026 07:24
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.

1 participant