Intents scan stalls for good on a skipped NEAR height #31

Closed
opened 2026-10-03 18:44:54 +00:00 by grenade · 0 comments
Owner

Why

Since the #30 deploy, the intents backfill on bob has logged near shard layout unreadable … 422 Unprocessable Entity for url (https://near.internal/) every 15 s: 57 times in 15 minutes. indexed_from has been stuck at 218,363,445 since the deploy before it.

Two bugs, either one enough to stall the scan.

  1. NEAR skips heights, and a batch reads its shard layout at its first height. Block 218,363,445 has prev_height 218,363,443. Height 218,363,444 was never produced, and every endpoint, including the archive, answers UNKNOWN_BLOCK for it. The descending batch starts at low - 1 = 218,363,444, asks EXPERIMENTAL_protocol_config at that height, fails, and retries the same question forever. The ascending side runs the same code and will freeze the same way the first time a batch begins on a skipped height. On NEAR that is a matter of when, not if.
  2. Our neard answers JSON-RPC errors with HTTP 422; FastNEAR answered them with 200. RpcClient::call_one calls error_for_status() before reading the body. A well-formed {"error": {"cause": {"name": "UNKNOWN_BLOCK"}}} therefore arrives as DataError::Http, a transport failure, and the error is never classified. chunk() cannot recognise a skipped height (it treats UNKNOWN_BLOCK at or above the live endpoint's earliest height as skipped), and deep() never asks the archive. It also breaks the house rule that a JSON-RPC error is the node answering: on a multi-endpoint chain, a 4xx with an error body would fail over.

What

  • call_one reads the body whatever the status. A JSON-RPC error is DataError::Rpc; a non-success status without a JSON-RPC body stays a transport-class failure that fails over.
  • The scan takes the shard layout from the first height in the batch that exists. It skips heights that are unknown everywhere rather than failing the batch on them.
  • A test for each.
## Why Since the #30 deploy, the intents backfill on bob has logged `near shard layout unreadable … 422 Unprocessable Entity for url (https://near.internal/)` every 15 s: 57 times in 15 minutes. `indexed_from` has been stuck at 218,363,445 since the deploy before it. **Two bugs, either one enough to stall the scan.** 1. **NEAR skips heights, and a batch reads its shard layout at its first height.** Block 218,363,445 has `prev_height` 218,363,443. Height 218,363,444 was never produced, and every endpoint, including the archive, answers `UNKNOWN_BLOCK` for it. The descending batch starts at `low - 1` = 218,363,444, asks `EXPERIMENTAL_protocol_config` at that height, fails, and retries the same question forever. The ascending side runs the same code and will freeze the same way the first time a batch begins on a skipped height. On NEAR that is a matter of when, not if. 2. **Our neard answers JSON-RPC errors with HTTP 422; FastNEAR answered them with 200.** `RpcClient::call_one` calls `error_for_status()` before reading the body. A well-formed `{"error": {"cause": {"name": "UNKNOWN_BLOCK"}}}` therefore arrives as `DataError::Http`, a transport failure, and the error is never classified. `chunk()` cannot recognise a skipped height (it treats `UNKNOWN_BLOCK` at or above the live endpoint's earliest height as skipped), and `deep()` never asks the archive. It also breaks the house rule that a JSON-RPC error is the node answering: on a multi-endpoint chain, a 4xx with an error body would fail over. ## What - `call_one` reads the body whatever the status. A JSON-RPC `error` is `DataError::Rpc`; a non-success status without a JSON-RPC body stays a transport-class failure that fails over. - The scan takes the shard layout from the first height in the batch that exists. It skips heights that are unknown everywhere rather than failing the batch on them. - A test for each.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blackbeard/observer#31