You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A request waiting on another's ledger load gets a flattened 404 that is_not_found() misses #2103
LedgerManager coalesces concurrent loads of the same ledger. The request that starts the load gets the typed error if it fails. Every request that waited on it gets the error flattened to ApiError::Http { status, message }, because ApiError isn't Clone. The status survives the flattening, and since #2102 it is the same status the typed error answers with. What the waiters lose:
is_not_found() is false. A waiter on a load of a name that is not a ledger gets Http { status: 404 }, which ApiError::is_not_found() does not match. The server routes that try a name as a ledger and then as a graph source (the JSON-LD and SPARQL query routes and /info, through load_ledger_or_missing) only fall back on is_not_found(). So when the first requests for a graph source arrive together, the waiters answer 404 instead of querying the source.
The @type is generic. A flattened 404 answers err:api/NotFound instead of err:db/LedgerNotFound, and any other typed error loses its specific code the same way.
I found this by reading the code, not by reproducing it.
Where
Four sites in fluree-db-api/src/ledger_manager.rs build the waiters' error with ApiError::http(e.status_code(), e.to_string()):
initial load: the leader publishes at L1766; waiters map it at L1620
reload: the leader publishes at L2045; waiters map it at L1893 and L1908
Fix direction
Keep the waiters' error typed wherever a caller branches on the type. The smallest version maps an is_not_found() error to ApiError::NotFound(message) for waiters, which carries both is_not_found() and err:db/LedgerNotFound. A more general one shares the leader's error as an Arc<ApiError> behind a variant that answers status_code(), error_type() and is_not_found() from the inner error.
A regression test should start two loads of a graph-source name together and check that both answer from the graph source.
Activity