• Stefy Lanza (nextime / spora )'s avatar
    frontproxy: fix leaked GPU-swap slot on request cancellation (queued swap never fired) · df948c48
    Stefy Lanza (nextime / spora ) authored
    The GpuSwapGate.release() was async and awaited in the dispatch `finally`
    blocks. When a request was cancelled/interrupted mid-flight (client disconnect,
    an interrupted text generation), `await self._swap_release(...)` in the finally
    could itself be cancelled BEFORE it decremented the running counter — stranding
    a gate slot. With `running` stuck > 0, `_pump()` never ran, so a video request
    queued behind the interrupted text request was never granted: the GPU never
    swapped even though the text engine had gone idle (observed: video stuck ~37min
    while the text engine was idle for 11).
    
    Fix: make release()/_pump() SYNCHRONOUS and drop the asyncio.Lock. Every critical
    section is straight-line (no await between read and write), so under asyncio's
    single thread they're already atomic — and a synchronous release from a `finally`
    always completes even while the coroutine is being cancelled. acquire() keeps its
    one `await` (the event wait) with synchronous cancel-cleanup. All release call
    sites are now non-awaited. Added `[gpu-swap] queued/swapping` logging so the
    owner/queue/swap transitions are visible in debug.log.
    
    Validated: cancelling a text request whose slot a queued video is waiting behind
    now frees the slot and grants the video; a cancelled queued waiter leaks nothing.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
    df948c48
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...
video_editor.config.json Loading commit data...