Repository navigation
Description
#2081 made decdn pool list read a node's buyer pools through admin_v1_pools instead of manufacturing an unrelated client store beside them. It deliberately does not fall back to reading from disk when the daemon is unreachable, because falling back to the client store is exactly the defect #2078 was about.
The consequence is that a stopped node's buyer.redb is now readable by nothing. Post-mortem inspection after a crash, or while a host is deliberately down for maintenance, has no route.
Why a disk read is legitimate here
redb holds its process-exclusive lock only for the lifetime of an open Database. Once the daemon exits the lock is released, and redb::ReadOnlyDatabase::open works — its own docs say "Multiple processes may open a ReadOnlyDatabase, but it may not be opened concurrently with a Database". So the impossibility that motivated the admin-RPC route is specific to a running daemon, and the lock itself is what tells the two cases apart: if the read-only open succeeds, no daemon holds the file.
Current behaviour
list_from_daemon (crates/cli/src/commands/pool.rs) hard-errors on any admin-call failure, discriminating only between "the daemon answered and refused" (jsonrpsee Call) and everything else. Connection-refused lands in the latter and produces "Start decdn-node, or pass --data-dir <client dir>" — correct advice for a node you want running, useless for one you are inspecting because it is not.
Suggested direction
On a connection-refused specifically, attempt ReadOnlyDatabase::open against <data_dir>/buyer.redb:
- Succeeds → render it, labelled distinctly.
source=node_store_offlinein--json, and astore=<path> (read from disk; no daemon running)line in the table, so the provenance stays unambiguous — the property the whole change exists to preserve. - Fails with
DatabaseAlreadyOpen→ a daemon is holding it, so the admin URL was wrong rather than the daemon being down. Say that instead; it is a strictly better error than the current one. - Fails otherwise → today's error.
Note this needs a read-only open path in decdn-incentive; RedbBuyerPoolStore::open uses Database::create, which would take the write lock (and, on a genuinely absent file, create one — the behaviour #2078 was about, so the read-only variant must never create).
Related
The same reasoning applies to decdn pool close --pool / reclaim --pool on a node data dir: they currently report the daemon's row as untouched on the grounds that a running daemon holds the store, but with the daemon stopped the CLI could clear that row honestly instead. Worth deciding alongside this, since both hinge on distinguishing "a daemon owns this dir" from "a daemon is running right now" — a distinction the current classifier does not make, by design.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
thiras commentedon Sep 20, 2026
Scoped to `pool list` in #2085. The "Related" half —
close --pool/reclaim --poolclearing a stopped daemon's row — is deliberately left out: it needs a write lock onbuyer.redb, which is a different capability from the read-only open, and one that races a daemon restarting mid-command.ReadOnlyBuyerPoolStorehas no write path on purpose.The distinction the issue asks for — "a daemon owns this dir" vs "a daemon is running right now" — does now exist in code (a successful read-only open proves the second is false), so the follow-up has what it needs.
🤖 Generated with Claude Code
fix(cli): batch of five CLI fixes around the node-vs-client data dir (#…