graphprotocol / graphprotocol/graph-node

Duplicate blocks in cache silently block subgraph indexing

オープン
#6,382 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@incrypto32 がすでに取り組んでいます。

2026年5月18日 から。

主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

説明

Summary

Duplicate blocks accumulating in the block cache (chainN.blocks) can cause subgraphs to stop indexing. The subgraph remains health=healthy and active=true but processes 0 blocks/s. The only symptom is an increasing blocks_behind count.

The error is only visible at DEBUG level:

Block stream produced a non-fatal error, error: block stream error Block 14500860 does not contain hash

This repeats every ~7 minutes indefinitely. The subgraph never fails or enters an unhealthy state — it just stops advancing.

Root cause

The block ingestor stores both branches of a reorg in the block cache without cleaning up orphaned entries. Under certain conditions (not fully characterized — it does not happen at every duplicate block), a subgraph hits a block where the hash it expects no longer resolves, causing the "does not contain hash" error loop.

It is unclear what exact combination of factors triggers the issue — the presence of duplicate blocks is a necessary condition, but there may be additional factors (e.g., specific reorg depth, timing of block ingestion vs subgraph processing).

Impact observed (production, ~250 subgraphs)

Chain Duplicate blocks Range checked Ratio
moonbeam 2,400+ 16,000 blocks ~15%
mainnet (Ethereum PoS) 1,382 full cache
  • Blocked subgraphs can show very high reorg_count (779,742 for the moonbeam case)
  • The issue is silent — no WARN/ERROR at default log level, health stays healthy
  • Observed on chains using RPC polling (not firehose)

Workaround

Remove duplicate blocks from the cache and perform a short rewind:

-- Find duplicate blocks
SELECT number, count(*) FROM chainN.blocks
GROUP BY number HAVING count(*) > 1;
# Remove duplicates (or truncate the whole chain cache)
graphman chain check-blocks <chain> by-range -f <from> -t <to> --delete-duplicates
# or: graphman chain truncate <chain>

# Then rewind the stuck subgraph with the correct block hash
graphman rewind --force --block-number <N> --block-hash <correct_hash> <deployment>

Related

  • #4792 — reports the same duplicate block storage issue

Environment

  • graph-node v0.41.1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。