Skip to content

Commit 0cdf9d7

Browse files
authored
Treat chain_modes=None as tracking every chain to fix validator TTL (linera-io#6167)
## Motivation PR linera-io#5991 fixed an inverted TTL assignment in `create_chain_worker`, swapping the branches so tracked chains use the long `config.ttl` and sender chains use the short `config.sender_chain_ttl`. Correct for clients (PM workers, wallets) where `chain_modes=Some(...)` distinguishes tracked from sender chains. Validators construct WorkerState with `chain_modes=None` (linera-service/src/server.rs:113) and have no tracked-vs-sender distinction. With `chain_modes=None`, `is_tracked` is always false, so post-linera-io#5991 every chain on a validator routes through `config.sender_chain_ttl`. The validator binary has no `--sender-chain-worker-ttl-ms` CLI flag, so `sender_chain_ttl` stays at the `ChainWorkerConfig::default()` value of `None`. Result: `spawn_keep_alive` is never called for any chain worker on a validator. The `Arc<ChainWorker>` drops the moment the in-flight request finishes, taking the per-chain `LruCachingStore` with it. Every subsequent request reloads chain state from Scylla. Empirical from testnet_conway V4 (running the post-linera-io#5991 no-actor code) vs V1-V3 (still running pre-fix actor.rs on testnet_conway_debug, where `is_tracked=false` correctly routes to `config.ttl=30s`): - `read_value` LRU cache hit rate: V4 2.66% vs V1-V3 75% - `find_keys_by_prefix` cache hit rate: V4 1.81% vs V1-V3 48% - `read_multi_value` rate to Scylla: V4 ~691/s vs V1-V3 ~75/s (9.2x) - p99 Scylla read latency: V4 42ms vs V1-V3 19-22ms; 30x worse stddev ## Proposal Treat `chain_modes=None` as "tracking every chain this node serves" — the validator natural semantic, since validators have no tracked-vs-sender split. For clients, behavior is unchanged: `chain_modes=Some(map)` still computes `is_tracked` from map membership and Full listening mode. One-line change: `chain_modes.as_ref().is_some_and(...)` becomes `is_none_or`. Inner `ListeningMode::is_full` check preserved unchanged. Restores the actor-model property (validators routed through `config.ttl`) without re-inverting the branches that linera-io#5991 correctly fixed for clients. ## Test Plan CI ## Release Plan - These changes should be backported to the latest testnet branch. ## Links - linera-io#5991, linera-io#5992, linera-io#6000 (the inversion fix this complements for validators) - linera-io#6160 (companion helm change adding `--chain-worker-ttl-ms` to validator chart)
1 parent 73d02dc commit 0cdf9d7

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

linera-core/src/worker.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,10 @@ where
10441044
.or_default()
10451045
.clone();
10461046

1047-
let is_tracked = self.chain_modes.as_ref().is_some_and(|chain_modes| {
1047+
// `chain_modes=None` means "no tracked/sender distinction" (validators) — treat
1048+
// every chain as tracked so it routes through `config.ttl`, not the unset
1049+
// `config.sender_chain_ttl` which would skip `spawn_keep_alive` entirely.
1050+
let is_tracked = self.chain_modes.as_ref().is_none_or(|chain_modes| {
10481051
chain_modes
10491052
.read()
10501053
.unwrap()

0 commit comments

Comments
 (0)