fix(neuron,candle): name lifetime on acquire_pool_lock
All checks were successful
build-prerelease / Resolve version stamps (push) Successful in 46s
CI / Format (push) Successful in 46s
CI / Clippy (push) Successful in 2m15s
CI / Test (push) Successful in 5m8s
build-prerelease / Build cortex binary (push) Successful in 4m21s
CI / Build cortex SRPM (push) Has been skipped
CI / Publish cortex to COPR (push) Has been skipped
CI / Build neuron SRPM (push) Has been skipped
CI / Publish neuron to COPR (push) Has been skipped
CI / Bump version in source (push) Has been skipped
build-prerelease / Build neuron-blackwell (push) Successful in 3m39s
build-prerelease / Package cortex RPM (push) Successful in 1m25s
build-prerelease / Build neuron-ampere (push) Successful in 5m25s
build-prerelease / Build neuron-ada (push) Successful in 5m3s
build-prerelease / Package helexa-neuron-ampere RPM (push) Successful in 3m0s
build-prerelease / Package helexa-neuron-blackwell RPM (push) Successful in 3m44s
build-prerelease / Package helexa-neuron-ada RPM (push) Successful in 7m41s
build-prerelease / Publish to rpm.lair.cafe (unstable) (push) Successful in 1m0s

Lifetime elision fails when a function has two reference parameters
and returns a borrow: rustc can't infer whether the MutexGuard's
lifetime ties to `pool` or `model_id`. The non-CUDA build skipped
this code path (cfg-gated), so the error only surfaced on the GPU
build at https://git.lair.cafe/helexa/cortex/actions/runs/162.

The guard borrows the pool, so name the lifetime on `pool` and the
return type. `model_id` keeps its independent (elided) lifetime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 12:37:32 +03:00
parent 67f79c868f
commit 2740e61a23

View File

@@ -453,10 +453,10 @@ const POOL_LOCK_WARN_THRESHOLD: Duration = Duration::from_secs(2);
/// the warn happens at the call site — the request whose lock-wait is /// the warn happens at the call site — the request whose lock-wait is
/// slow is the one that knows its prompt_len and other context. /// slow is the one that knows its prompt_len and other context.
#[cfg(feature = "cuda")] #[cfg(feature = "cuda")]
async fn acquire_pool_lock( async fn acquire_pool_lock<'a>(
pool: &tokio::sync::Mutex<super::tp::WorkerPool>, pool: &'a tokio::sync::Mutex<super::tp::WorkerPool>,
model_id: &str, model_id: &str,
) -> tokio::sync::MutexGuard<'_, super::tp::WorkerPool> { ) -> tokio::sync::MutexGuard<'a, super::tp::WorkerPool> {
let start = std::time::Instant::now(); let start = std::time::Instant::now();
// Tick once at the threshold so a stuck request shows up in // Tick once at the threshold so a stuck request shows up in
// journalctl even while it's still waiting. Without this the wait // journalctl even while it's still waiting. Without this the wait