Repository navigation
fix: prevent backend lock contention from freezing the server - #874
Merged
Merged
Conversation
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.
Problem and scope
The live ASGI main thread was blocked on a Python lock while background work continued; two independent health probes timed out. The same problem reproduces deterministically with a held job-admission path. The new contention regression fails on unchanged base b10d1bc and passes with this patch. Native sampling did not reveal the exact live Python lock owner; elevated Python stack attachment was unavailable.
Audited asynchronous app routes, shared job/control entry points, project/progress/database and cache boundaries, room/MCP dispatch, login/OAuth, diagnostics and shutdown. Details:
docs/SERVER_LOCK_AUDIT.md.Changes
Verification
311 targeted Python tests passed across route security, server/worker contention, settings/login/OAuth, room/browser behavior, project caches, source updates, repair routes, startup, MCP responsiveness and shutdown. The contention cases use a single ASGI event loop and require concurrent health responses while job admission, reservation, progress and a real database writer are held. The delayed database write commits and passes SQLite integrity checking. Watchdog and recursive/bounded cache waits are covered.
Four Node GUI suites pass (repository setup/sync/push and room reconnect); Ruff (
src tests projects) andgit diff --checkpass. Demo-ROM validation uses local LLVM tools. No paid model requests or live-project mutations/restarts were used.One unrelated room-browser mocked imported-build test (
test_compile_dispatches_to_normal_engine_without_leaking_diff[True]) fails identically on unmodified b10d1bc. It was excluded; its ROM counterpart and the real browser byte-match case passed. This is a targeted regression run, not a claim that the full repository suite passes.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.