Skip to content

Fix intermittent infinite 'Loading project...' hang (EOSE race with never-connected relays) - #954

Open
dangershony wants to merge 1 commit into
mainfrom
fix/eose-hang-project-load
Open

Fix intermittent infinite 'Loading project...' hang (EOSE race with never-connected relays)#954
dangershony wants to merge 1 commit into
mainfrom
fix/eose-hang-project-load

Conversation

@dangershony

Copy link
Copy Markdown
Member

Problem

Deep-linking to /investview/{projectId} intermittently hangs forever on the loading spinner. The indexer lookup succeeds, but the Nostr metadata fetch never completes when some relays (e.g. relay.damus.io, nostr-02.yakihonne.com) fail the WebSocket upgrade.

Root cause: the EOSE tracking snapshot in NostrCommunicationFactory.GetAllConnectedRelayNames() included all registered clients, even relays that never connected. Such relays never send EOSE, and their DisconnectionHappened event fired during startup — before any subscription was monitored — so nothing ever removed them from the tracking set and the 'all relays sent EOSE' completion callback never fired. Timing-dependent, hence intermittent.

Fixes

  • EOSE tracking: only snapshot relays whose websocket is actually running (\Communicator.IsRunning); dead relays can no longer block completion (the existing disconnect-removal re-check remains as a second safety net)
  • Load timeout: 30s watchdog on the InvestView remote project load — the UI now falls back to an error message instead of spinning forever
  • NIP-65 via purple relays: \LookupRelayListForNPubs\ now also queries the discovery ('purple pages') relays where relay lists are actually published, with proper EOSE tracking (\includeDiscoveryRelays) and CLOSE sent on discovery relays too
  • Premature close fix: \MergeProjectRelays\ now passes a real end-of-stream callback; previously with
    ull\ the relay-list subscription was closed on the first EOSE from any relay, often before results arrived
  • Settings escape hatch: the standalone InvestView header (and the loading/error states) now link to /settings so users can fix relay/indexer configuration when loading fails

Validation

  • Angor.Shared.Tests: 155/155 passed
  • Angor.Sdk.Tests: 333 passed
  • UAT (CreateProjectTest, MultiFund, MultiInvest): 3/3 passed (14m29s, real signet transactions)
  • WebApp.sln builds with 0 errors

…acking of never-connected relays

- Only track relays whose websocket is actually running in EOSE/OK snapshots;
  a relay that never completed the WS upgrade never sends EOSE and its
  DisconnectionHappened fired before monitoring started, blocking completion forever
- Add 30s watchdog to InvestView remote project load so the UI falls back to an
  error message instead of spinning indefinitely
- Query discovery (purple pages) relays for NIP-65 relay lists in
  LookupRelayListForNPubs and include them in EOSE tracking; close REQ on
  discovery relays too
- Pass a real end-of-stream callback from MergeProjectRelays so the relay-list
  subscription isn't closed on the first EOSE from any relay
- Add Settings link to the standalone InvestView header and loading/error states
  so users can fix relay/indexer settings when loading fails
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