Relay REQ budget (20 subscriptions) exhausted mid-session — late subscriptions silently die until reload #18
Labels
No labels
bug
discussion
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
edufeed/edufeed-app#18
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while investigating #4. A single app session quickly produces dozens of relay NOTICEs
ERROR: too many concurrent REQson relay.edufeed.org / relay-rpi.edufeed.org / nos.lol (strfrymaxSubsPerConnection = 20).Once the per-connection budget is exhausted, every later REQ on that socket silently fails — share-state detection, kind 10002 relay-list fetches, NIP-46 signer subscriptions. A page reload gives a fresh socket and everything works again, which users experience as "random breakage that a reload fixes" (see #4).
Needs: an audit of subscription lifecycles (leaked/never-closed REQs), possibly multiplexing or closing one-shot REQs eagerly, and surfacing relay NOTICEs in debug mode.
Full audit done (read-only). Root cause mechanics:
maxSubsPerConnection = 20.pool.subscription()streams hang forever. That's the "silently broken until reload".Ranked hotspots:
CommunitySharemounts eagerly inside CLOSED dialogs (EventContextMenu,CalendarEventDetailsModal,AddToCalendarDropdown,ResourceFormWizard): every rendered card fires 2–4 share-detection REQs even though the dialog was never opened. 10 cards = 20–40 REQs → blows the budget alone.pool.subscription()(never EOSE-completes) + per-author deletion loaders.Existing good pattern: the reactions loader batches per-card queries (
bufferTime+ lazy IntersectionObserver) — share detection should do the same.Remediation plan (priority order):
CommunityShareuntil its dialog is actually open — biggest single win, likely resolves the symptom.kinds:[6,16,30222],#e+#a).too many concurrent REQsNOTICE (back off + re-dispatch) instead of hanging.getAllLookupRelays(),lazyReactionBar in AMB grid cards.Implementing (1) and (2) now; (3)/(4) are a bigger infrastructure change worth its own PR.
Quick wins 1+2 from the plan are implemented on branch
fix/issue-18-share-detection-reqs(with tests, verified at runtime): CommunityShare no longer mounts inside closed dialogs/dropdowns — detection REQs fire only when the share UI actually opens — and detection itself collapsed from up to 4 loaders to ONE REQ with merged filters over a de-duplicated relay set. Remaining (bigger, separate PR): per-connection REQ semaphore + reacting to the too-many-REQs NOTICE, plus one-shot lifetimes for persistent pool.subscription() streams.Confirmed by Steffen; quick wins merged to dev. The systemic follow-up (per-connection REQ semaphore + NOTICE handling) stays documented in the audit above — reopen or file fresh if the symptom recurs.