Skip to content

Fix false lag banner, live-update request storm, and full-screen chunk errors - #32

Merged
NateIsern merged 3 commits into
mainfrom
fix/health-fork-peers
Nov 16, 2026
Merged

NateIsern merged 3 commits into
mainfrom
fix/health-fork-peers

Conversation

@NateIsern

Copy link
Copy Markdown
Member

Summary

Production incident from 2026-11-16. The explorer showed "This explorer's node is catching up" most of the time, pages sometimes didn't load, and a full-screen "Failed to fetch dynamically imported module" error replaced the app. There were three separate causes:

  • False lag banner. /api/health used the tallest height any peer claimed as the network tip. A peer (fcnode2) has been on a separate, lower-difficulty PoS branch since height 166299 (2026-09-24), ~200 blocks taller. Lag now comes from the node's own most-work header (getblockchaininfo.headers) while the tip is fresh. Peer claims still count once the tip is cold, so a genuinely stuck node is still reported stalled.
  • Request storm that looked like a bot. If the monitor's startup getblockcount failed, it kept height 0. The next poll then announced all ~241k blocks as new-block, and every event made each open tab refetch /api/stats and /api/peers. One visitor ended up sending ~60 req/s for hours, which saturated the 1-vCPU host and starved faircoind. The fix:
    • an unestablished height is adopted as a baseline;
    • at most 10 blocks are announced per poll;
    • polls never overlap;
    • the client throttles live-event invalidations per key.
  • Full-screen crash on a failed chunk. Route chunks now load with retry and one guarded reload. Each content panel has its own PanelErrorBoundary, so a failure stays inline.

Also:

  • cache.get serves the last value once on RPC failure instead of retrying, which used to double the timeout. /api/health opts out of this.
  • Cache freshness follows the reader's TTL.

Test plan

  • tsc -b, tsc -p server/tsconfig.json
  • vitest run: 142 tests, with new tests for health assessment, cache fallback/TTL, block announcement planning, throttled invalidation, and lazy import retry
  • vite build
  • After deploy: /api/health reports ok, no banner, request rate back to normal

🤖 Generated with Claude Code

NateIsern and others added 3 commits November 16, 2026 16:10
…ng up" banner

/api/health took the tallest height any peer claimed as the network tip.
Since 2026-09-24 (height 166299) a public peer (187.33.155.242) follows a
separate, ~4x lower-difficulty PoS branch that is ~200 blocks taller than
the heavier chain the explorer's node follows, so the endpoint reported
"lagging" forever and the site showed the banner to every visitor.

While the tip is fresh, lag now comes from the node's own most-work header
(getblockchaininfo.headers); peer heights still count once the tip is cold,
so a genuinely stuck node is still reported as stalled.

Also make the cache serve its last value once when the RPC fails instead of
retrying the same call (which doubled the wait to 20s+ per key and left pages
empty), with /api/health opting out; and make cache freshness honour the
reader's TTL when call sites share a key.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A route chunk that failed to load (server restarting, flaky connection, or a
deploy that replaced the hashed chunk names) propagated to the root error
boundary and replaced the entire app with "Something went wrong / Failed to
fetch dynamically imported module".

- lazyWithRetry: retry chunk imports with backoff, then reload once (guarded
  by sessionStorage so it can never loop) to pick up a fresh build.
- Wrap each content panel in Bloom's PanelErrorBoundary, reset on navigation,
  so any page failure stays inline with a retry while navigation keeps working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wser

If the startup getblockcount failed (node busy), the monitor kept its initial
height of 0. The next successful poll saw ~241k "new" blocks and announced
them one by one from height 1; every new-block event made each open tab
refetch /api/stats and /api/peers. A single visitor with the home page open
became ~60 req/s for hours, saturating the 1-vCPU host and starving faircoind
(RPC timeouts, watchdog restarts every 30 min).

- Treat an unestablished tip as a baseline to adopt, never a backlog.
- Announce at most 10 blocks per poll; larger gaps get one block-count event.
- Never start a poll while the previous one is still running.
- Client: throttle live-event invalidations per query key (leading +
  trailing, 5s), so a burst of server events can never become a burst of
  HTTP requests from every tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NateIsern
NateIsern merged commit 23f5b67 into main Nov 16, 2026
1 check passed
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