Skip to content

fix: stop popup hang on failed DAG resolution#1390

Open
lidel wants to merge 3 commits into
mainfrom
fix/dag-data-resolve-hang
Open

fix: stop popup hang on failed DAG resolution#1390
lidel wants to merge 3 commits into
mainfrom
fix/dag-data-resolve-hang

Conversation

@lidel

@lidel lidel commented Jul 22, 2026

Copy link
Copy Markdown
Member

Problem

On an IPNS or DNSLink page, opening the browser-action popup could leave the Copy CID, immutable-path, and permalink rows stuck on (waiting for DAG data) forever. The rows are filled by a live ipfs.resolve() call with no error handling, so if that call rejected or hung, the result was never cached and the follow-up render never ran. Making it worse, p-memoize v8 ignores maxAge, so resolved CIDs were memoized in a plain Map that never expired, and a stale CID could show for the whole service-worker lifetime.

Fix

  • Guard the resolution with a 15s timeout and a try/catch; on failure show an unavailable hint and retry on the next poll instead of spinning.

  • Back the CID/path memoization with an LRU cache capped at 1 minute (mutable IPNS/DNSLink targets can change; ipfs.resolve() does not expose the record TTL).

  • Closes error: Waiting for DAG data in main menu #1334

lidel added 3 commits July 22, 2026 12:39
The browser-action popup resolved a tab's CID and immutable path with a
live ipfs.resolve() call and no error handling. When that call rejected
or hung, the result cache was never written and the follow-up render
never ran, so the CID, immutable-path and permalink rows stayed on the
"(waiting for DAG data)" placeholder forever.

Guard the resolution with a 15s timeout and a try/catch. On failure,
cache the error briefly (3s) so the rows show an "unavailable" hint
instead of spinning, retries stay paced by the popup poll rather than
looping, and a recovered node is picked up on the next poll.

Closes #1334
p-memoize v8 ignores the maxAge option, so resolveToCid and
resolveToImmutableIpfsPath memoized results in a plain Map that never
expired. Both come from mutable IPNS/DNSLink lookups whose target can
change, so a stale CID could be shown for the whole service-worker
lifetime. Back the memoization with an LRU cache capped at 1 minute.
Extend the existing distrust note to x-ipfs-roots and spell out that
neither header may be read to shortcut work like the popup's Copy CID;
resolve through the IPFS node instead.
@lidel
lidel requested a review from a team as a code owner July 22, 2026 10:55
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.

error: Waiting for DAG data in main menu

1 participant