Skip to content

fix(node): don't spawn Frontier-RPC pool validation tasks as essential#4051

Merged
Kailai-Wang merged 2 commits into
devfrom
fix/heima-node-frontier-rpc-pool-essential-task
Jun 25, 2026
Merged

fix(node): don't spawn Frontier-RPC pool validation tasks as essential#4051
Kailai-Wang merged 2 commits into
devfrom
fix/heima-node-frontier-rpc-pool-essential-task

Conversation

@Kailai-Wang

Copy link
Copy Markdown
Collaborator

Problem

Every v0.9.26 node image crashes immediately on heima — even on a fresh genesis DB at #0:

[Parachain] Essential task `transaction-pool-task-0` failed. Shutting down service.
[Parachain] Essential task `transaction-pool-task-1` failed. Shutting down service.
Error: Service(Other("Essential task failed."))

This is why production has never been able to move off v0.9.25-01. It is not a host-function or runtime-version issue (the on-chain runtime imports zero moonbeam host functions); it is a node-side wiring bug.

Root cause

The standard-frontier migration (#3841, commit 305767d2d) added a secondary transaction pool, used only to expose a low-level sc_transaction_pool::Pool<FullChainApi> (graph) to the standard Frontier txpool/graph RPC (which requires the inner pool type, unlike the old fork that accepted the high-level handle):

let chain_api = Arc::new(sc_transaction_pool::FullChainApi::new(
    client.clone(), None, &task_manager.spawn_essential_handle(),  // <-- essential
));

FullChainApi::new spawns two transaction-pool-task-{0,1} validation tasks via that spawner. Their loop returns when the validation channel closes, and they resolve at startup. Because they were spawned with the essential handle, an essential task ending (not even panicking) triggers task_manager's "Essential task failed. Shutting down service." — tearing the whole node down. (No panic/backtrace ever appears precisely because it's a normal task completion, not a panic.)

Fix

Spawn that secondary RPC-only pool's tasks non-essentially via a small NonEssentialSpawner adapter that implements SpawnEssentialNamed by forwarding to the ordinary SpawnNamed methods of a SpawnTaskHandle. The Frontier RPC graph still works; those tasks completing is no longer fatal. The primary transaction pool (and --pool-type) is untouched.

Testing

  • Reproduces deterministically on a fresh heima genesis DB with any v0.9.26 build; the crash disappears with this change in principle (validation-task completion no longer fatal).
  • Could not fully type-check locally (unrelated macOS rpassword/__errno_location toolchain issue blocks the build on the dev machine before reaching the node crate); relying on CI (Linux) for the compile, and recommend validating the built image against a heima DB snapshot before any production swap.

Note

Keep prod on v0.9.25-01 until an image built from this is verified to start and author on a heima snapshot.

The standard-frontier migration (#3841) added a secondary transaction pool
solely to expose a low-level `graph::Pool` to the Frontier txpool/graph RPC,
built via `FullChainApi::new(.., &task_manager.spawn_essential_handle())`.

`FullChainApi::new` spawns two `transaction-pool-task-{0,1}` validation tasks
through that spawner. Because they were spawned with the ESSENTIAL handle, when
those tasks resolve at startup the whole node is torn down with
`Essential task `transaction-pool-task-0` failed. Shutting down service.` —
deterministically, even on a fresh genesis DB. This made every v0.9.26 image
unable to start on heima (it was never a host-function/runtime issue).

Spawn that secondary pool's tasks NON-essentially via a small
`NonEssentialSpawner` adapter (forwards SpawnEssentialNamed -> ordinary
SpawnNamed). The RPC graph still works; the tasks completing is no longer fatal.
The primary transaction pool is unaffected.
@vercel

vercel Bot commented Jun 25, 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 Jun 25, 2026 12:43pm

Request Review

SpawnTaskHandle's spawn/spawn_blocking are inherent methods, so the SpawnNamed
trait need not be in scope. CI builds with -D warnings, and the unused import
failed parachain-check.
@Kailai-Wang Kailai-Wang enabled auto-merge (squash) June 25, 2026 13:31
@Kailai-Wang Kailai-Wang merged commit a0a061b into dev Jun 25, 2026
15 checks passed
@Kailai-Wang Kailai-Wang deleted the fix/heima-node-frontier-rpc-pool-essential-task branch June 25, 2026 13:42
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