Repository navigation
fix(server): take the store mutex in separate statements so uteke-serve starts - #1786
Merged
Merged
Conversation
…ve starts uteke-serve v0.24.0 stopped after 'Lifecycle config loaded' and never listened. main built the request context in one 'let ctx = ...' statement that took the Mutex<Uteke> twice (the [recall] defaults from #1754 and the embedding gate from #1753). A temporary MutexGuard lives to the end of the statement, so the second lock() waited on the first forever. Take each value in its own statement. Add a test that starts the real uteke-serve on an empty store and waits for GET /health; it fails (hangs at startup) without the fix and passes with it.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
9 of 12 tasks
ajianaz
added a commit
that referenced
this pull request
Nov 17, 2026
Patch release for the uteke-serve startup hang in 0.24.0 (#1786), plus the remote document search query bound (#1777). Version in the workspace Cargo.toml, the internal deps of uteke-core, cli, mcp and server, Cargo.lock, both skill copies, server.json, gemini-extension.json, docs/core-contract.json (regenerated with docgen), docs/docker.md and docs/install.md. CHANGELOG entry with a correction to the 0.24.0 notes: a 0.23.0 binary refuses a schema v26/v27 store. Co-authored-by: ajianaz <[email protected]>
10 of 12 tasks
ajianaz
added a commit
that referenced
this pull request
Nov 17, 2026
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
uteke-servev0.24.0 never starts listening.mainbuilt the request context in onelet ctx = ...statement that took theMutex<Uteke>twice. Each value is now taken in its own statement, and a new test starts the real binary and waits forGET /health.Why
Every start of v0.24.0 stops right after the log line
Lifecycle config loadedand never printsUteke server listening. In Docker that shows as an unhealthy container (the healthcheck iscurl -f /health),docker stopends in rc=137 because PID 1 ignores SIGTERM, and the stuck process keeps the index file lock, soverify,repairanddoctorblock.Cause:
let ctx = ReqCtx { recall_config: Some(uteke.lock()...recall_settings().clone()), ..., remote_embeds: uteke.lock()...embed_gate().clone() }. A temporaryMutexGuardlives to the end of the enclosing statement, so the first guard was still alive at the secondlock(), and a stdMutexis not reentrant. v0.23.0 hadrecall_config: Some(engine.recall.clone())with no lock. The first lock came from #1754, the second from #1753; each is fine alone.develophas the same code.It is not the index lock path:
acquire_file_lockand the in-memory fallback are identical in v0.23.0 and v0.24.0.How
recall_configandremote_embedsare read into locals, each in its own statement, beforelet ctx. No behaviour change besides the server starting.New test
crates/uteke-server/tests/startup_listens.rs: spawnsCARGO_BIN_EXE_uteke-serveon a free port with an empty data dir and an external embedder pointed at a closed port (no ONNX runtime, no model), and waits up to 60 s forGET /healthto answer 200. It reports the server log if the process exits or never answers.Testing
cargo test --workspacepasses (not run: the workspace with default features; run on the touched package below, CI runs the rest)cargo test -p uteke-server --no-default-features --features vecq: 285 tests pass (42 lib, 232 bin, 3 + 7 integration, 1 new)cargo fmt --all -- --checkpassescargo clippy -p uteke-server --all-targets --no-default-features --features vecq -- -D warningspasses/health200, v0.24.0 hangs (twice), v0.24.0 plus this fix answers 200. The hung process is single-threaded, 0% CPU, waiting on a futex; as PID 1 of its own namespace it ignores SIGTERM and dies on SIGKILLutekeCLI 18/18 commands (remember, recall, search, list, stats, context, doctor, verify, export, repair, namespace, room, tags),uteke-mcpover stdio 9/9 (57 tools, remember, recall, stats,isError:trueon a missing id),uteke-serve20/20 routes with a token (auth 401, host guard 403, 400 and 404 error classes, room and doc routes, and the embedding gate answers 429 to the third and fourth parallel hybrid search)lock()orwrite()on the same receiver inside one statement, or inside anif let/match/while letheader and its block: only this oneRelated Issues
Affects v0.24.0 (released 2026-11-13). Introduced by #1754 and #1753. A patch release needs the owner's approval of the version.
Checklist
fix/)develop(at cefcf0a)Not covered: the same build with default features (usearch plus vecq) was not run locally, CI does that. The static scan is a heuristic; it does not follow a lock held across a function call.
Generated by Claude Code