Repository navigation
Conversation
This was referenced Oct 19, 2026
Rust-Checks has failed on main since the NU6.3 toolchain bump: rustfmt differs in nine files, and clippy on nightly-2025-06-15 rejects ten uninlined format arguments in webzjs-keys and one map iteration in webzjs-requests under -D warnings. Apply rustfmt and clippy's own suggestions; no behaviour changes.
Leaving the wallet open on Account Summary crashed after roughly 75
minutes with:
panicked at sharded-slab-0.1.7/src/shard.rs:295:9:
Thread count overflowed the configured max count.
Thread index = 128, max threads = 128.
followed by `RuntimeError: unreachable`, after which the wallet hung.
`WebWallet::sync` spawned a fresh web worker for every call, and the
periodic rescan calls it every 35 seconds. The tracing registry stores
spans in a sharded slab that allows 128 thread slots on wasm32; a thread
takes a slot the first time it creates a span (block scanning does) and
gives it back only from its thread-local destructor. Those destructors
never run here: wasm_thread is built with `keep_worker_alive`, so
finished workers are not closed at all, and closing a worker skips Rust
thread-local drops anyway. So every sync consumed one slot for good, and
sync number 129 panicked. The idle workers also kept their stacks and
thread-local storage, so memory grew per sync as well.
Run all syncs on a single long-lived worker, created on first use and
fed through a channel. Requests run one at a time, which the JS caller
already enforces with its sync-in-progress guard.
A trap inside the worker (a Rust panic compiled to wasm) is not recovered
from: the trapped call never resolves and later syncs wait behind it until
the page is reloaded. That was already the case with a worker per call, which
held the wallet lock forever after a trap.
The shared sync worker uses tokio::sync::{mpsc, oneshot}, which only compiled
because another dependency happened to enable the feature.
sqhell
force-pushed
the
fix/reuse-sync-worker
branch
from
October 19, 2026 16:51
c22f65a to
fbdd562
Compare
This branch has not been deployed
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.
What
WebWallet::syncruns every sync on a single long-lived web worker, created on first use and fed through a channel; requests run one at a time.webzjs-walletdeclares tokio'ssyncfeature explicitly (it usestokio::sync::{mpsc, oneshot}and only compiled because another dependency enabled it).Why
Leaving the wallet open on Account Summary crashed after roughly 75 minutes with
Thread count overflowed the configured max count. Thread index = 128, max threads = 128followed byRuntimeError: unreachable, after which the wallet hung. Each sync spawned a fresh worker; the tracing registry allows 128 thread slots on wasm32 and a slot is only returned from a thread-local destructor that never runs for these workers, so sync number 129 panicked. Idle workers also kept their stacks, so memory grew per sync.Stack
Position 2 of 15 in the WebZjs release order, to be merged in this order into
main. Independent of the feature PRs but rebased on #20 (chore/rust-checks) so its checks are green; the commits of this PR alone are here: sqhell/WebZjs@chore/rust-checks...fix/reuse-sync-workerchore/rust-checksfix/reuse-sync-worker(this PR)fix/grpc-web-trailers-onlyfix/resync-dialogfeat/send-againfix/pczt-parse-errorfix/sign-change-paired-spendsfix/historic-sync-oomfeat/history-resync-hintfix/wallet-store-epochsfeat/ironwood-poolfix/history-from-spendsfeat/wallet-statsfeat/resumable-syncfeat/resync-resumeRust pins reference
sqhell/zcash_client_memoryandsqhell/librustzcashby revision so CI builds exactly what was tested; once the zcash_client_memory stack (red-dev-inc/zcash_client_memory #16 to #21) merges, the memory pin goes back tored-dev-inc/zcash_client_memoryfeat/snap-nu63. The integration branchtest/all-fixeson the fork merges all fourteen and is the build that was tested end to end.Tests