Skip to content

Filter benign UnsubscriptionError noise during dot deploy#27

Merged
UtkarshBhardwaj007 merged 2 commits intomainfrom
fix/suppress-unsubscription-noise
Apr 19, 2026
Merged

Filter benign UnsubscriptionError noise during dot deploy#27
UtkarshBhardwaj007 merged 2 commits intomainfrom
fix/suppress-unsubscription-noise

Conversation

@UtkarshBhardwaj007
Copy link
Copy Markdown
Member

Summary

  • Filters the cosmetic rxjs UnsubscriptionError: Not connected stack trace that fired from polkadot-api's client.destroy() during the availability check's dotns.disconnect() — swallow the benign case from both unhandledRejection and uncaughtException, escalate everything else. Narrow match (name === "UnsubscriptionError" AND every inner error is /not connected/i AND array non-empty) so a new rxjs failure still surfaces.
  • Adds a README Troubleshooting section pointing users at DOT_MEMORY_TRACE=1 DOT_DEPLOY_VERBOSE=1 for memory / OOM bug reports — the watchdog worker + timestamped log interceptor are much more useful than a stack trace alone.
  • 8 new unit tests on the isBenignUnsubscriptionError helper covering the expected matches, the mixed-error rejections, and non-Error inputs.

Why this is cosmetic, not a real crash

The error lives in rxjs Subscription teardown. dotns.disconnect() at availability.ts:207 calls client.destroy(), which synchronously closes the WS. The client's still-live chainHead follow subscription has a finalizer that calls the provider's request(cancel) method, which now throws "Not connected" because the socket is gone on purpose. rxjs collects the thrown errors into UnsubscriptionError. Users saw this printed right under Required status: ProofOfPersonhoodFull, making it look like personhood caused the crash — but on Paseo, PoP-classified names are deployable (bulletin-deploy self-attests via setUserPopStatus). The deploy was never actually broken by this.

Test plan

  • pnpm test — 189 tests pass (21 files), includes the 8 new process-guard.test.ts cases
  • npx tsc --noEmit — clean
  • Manual: dot deploy on a Full-PoP name (e.g. rpc-test-app.dot) no longer prints the 40-line UnsubscriptionErrorImpl stack; the deploy proceeds.
  • Manual: DOT_DEPLOY_VERBOSE=1 dot deploy prints the one-line (suppressed benign post-destroy UnsubscriptionError: Not connected) note on the same path.
  • Manual: force a genuine rejection elsewhere (e.g. throw a plain Error("boom") in a dev build) and confirm the handler still escalates via runAllCleanupAndExit(1).

polkadot-api's `client.destroy()` tears down a still-live chainHead follow
subscription whose finalizer calls a cancel RPC on the socket we just
closed. The cancel throws "Not connected" (by design — the socket is gone
on purpose), rxjs wraps the collected errors in UnsubscriptionError, and
depending on whether the finalizer runs from a microtask or a sync path
the whole thing surfaces as either `unhandledRejection` or
`uncaughtException`. Today the former is tearing the deploy down with a
40-line stack trace printed right under `Required status:
ProofOfPersonhoodFull`, which reads as if personhood caused the crash —
it didn't.

`isBenignUnsubscriptionError` narrowly matches the known-benign shape
(name === "UnsubscriptionError" AND every inner error message matches
`/not connected/i` AND the array is non-empty). `installSignalHandlers`
now swallows matches from BOTH rejection and exception handlers; anything
else still escalates via `runAllCleanupAndExit(1)` as before. Verbose
mode (`DOT_DEPLOY_VERBOSE=1`) prints a one-line note when a filter fires
so diagnostic runs still see something.

Also adds a Troubleshooting section to the README pointing users at
`DOT_MEMORY_TRACE=1 DOT_DEPLOY_VERBOSE=1` for memory / OOM bug reports —
the watchdog worker samples RSS on its own event loop and the verbose
interceptor timestamps every bulletin-deploy log line, so attaching the
combined output correlates growth with chunk / retry events.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 19, 2026

Dev build ready — try this branch:

curl -fsSL https://raw.githubusercontent.com/paritytech/playground-cli/main/install.sh | VERSION=dev/fix/suppress-unsubscription-noise bash

@UtkarshBhardwaj007 UtkarshBhardwaj007 merged commit 84fe6f5 into main Apr 19, 2026
5 checks passed
@UtkarshBhardwaj007 UtkarshBhardwaj007 deleted the fix/suppress-unsubscription-noise branch April 19, 2026 20:41
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