Summary
The head-change broadcast channel can overwrite unread updates when a consumer falls behind. This can leave an index incomplete or stale.
Migrate the head-change publication mechanism to async-broadcast and disable overflow.
Rationale
The NoSQL index has the same risk at src/daemon/db_util.rs near Line 833. The SQLite chain indexer introduced in #6720 also consumes head changes. A lagging consumer must not silently lose head-change updates.
Affected areas
src/daemon/db_util.rs head-change publication and NoSQL index consumption.
- SQLite chain indexer head-change consumption in
src/chain/store/indexer.rs.
- Any other consumers of the same head-change channel.
Required changes
- Replace the applicable Tokio broadcast channel with
async-broadcast.
- Configure the channel so that sends do not discard unread messages on overflow.
- Update all producers and consumers for the new channel API.
- Define and implement shutdown behavior so blocked senders or receivers can exit cleanly.
Acceptance criteria
- A slow index consumer does not lose head-change updates because of channel-buffer overflow.
- Both the NoSQL index and SQLite chain indexer continue to process ordered head changes.
- Tests cover a consumer that falls behind the configured channel capacity.
- Shutdown does not leave channel tasks blocked.
Requested by: @hanabi1224
Backlinks:
Summary
The head-change broadcast channel can overwrite unread updates when a consumer falls behind. This can leave an index incomplete or stale.
Migrate the head-change publication mechanism to
async-broadcastand disable overflow.Rationale
The NoSQL index has the same risk at
src/daemon/db_util.rsnear Line 833. The SQLite chain indexer introduced in #6720 also consumes head changes. A lagging consumer must not silently lose head-change updates.Affected areas
src/daemon/db_util.rshead-change publication and NoSQL index consumption.src/chain/store/indexer.rs.Required changes
async-broadcast.Acceptance criteria
Requested by: @hanabi1224
Backlinks: