Filter benign UnsubscriptionError noise during dot deploy#27
Merged
UtkarshBhardwaj007 merged 2 commits intomainfrom Apr 19, 2026
Merged
Filter benign UnsubscriptionError noise during dot deploy#27UtkarshBhardwaj007 merged 2 commits intomainfrom
UtkarshBhardwaj007 merged 2 commits intomainfrom
Conversation
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.
Contributor
|
Dev build ready — try this branch: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UnsubscriptionError: Not connectedstack trace that fired frompolkadot-api'sclient.destroy()during the availability check'sdotns.disconnect()— swallow the benign case from bothunhandledRejectionanduncaughtException, escalate everything else. Narrow match (name === "UnsubscriptionError"AND every inner error is/not connected/iAND array non-empty) so a new rxjs failure still surfaces.DOT_MEMORY_TRACE=1 DOT_DEPLOY_VERBOSE=1for memory / OOM bug reports — the watchdog worker + timestamped log interceptor are much more useful than a stack trace alone.isBenignUnsubscriptionErrorhelper 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()atavailability.ts:207callsclient.destroy(), which synchronously closes the WS. The client's still-live chainHead follow subscription has a finalizer that calls the provider'srequest(cancel)method, which now throws "Not connected" because the socket is gone on purpose. rxjs collects the thrown errors intoUnsubscriptionError. Users saw this printed right underRequired status: ProofOfPersonhoodFull, making it look like personhood caused the crash — but on Paseo, PoP-classified names are deployable (bulletin-deploy self-attests viasetUserPopStatus). The deploy was never actually broken by this.Test plan
pnpm test— 189 tests pass (21 files), includes the 8 newprocess-guard.test.tscasesnpx tsc --noEmit— cleandot deployon a Full-PoP name (e.g.rpc-test-app.dot) no longer prints the 40-lineUnsubscriptionErrorImplstack; the deploy proceeds.DOT_DEPLOY_VERBOSE=1 dot deployprints the one-line(suppressed benign post-destroy UnsubscriptionError: Not connected)note on the same path.Error("boom")in a dev build) and confirm the handler still escalates viarunAllCleanupAndExit(1).