• Aryan Noshirvani's avatar
    Fix Demucs concurrency hang causing "Failed to fetch" mid-poll · 83b9fafc
    Aryan Noshirvani authored
    Root cause of the reported polling failure: two remix jobs submitted
    close together both landed in separate_stems() around the same time
    and hung indefinitely - confirmed via direct DB inspection, both stuck
    at "separating" with zero progress and low process CPU for 30+ seconds
    straight, not just slow. Each call was also instantiating a brand new
    demucs.api.Separator (reloading model weights from disk) every single
    time, with no thread-safety guarantee from demucs/HF Hub's model
    caching under concurrent access - the likely deadlock source.
    
    Fixed by caching a single lazily-created Separator instance and
    wrapping all separation calls in a threading.Lock, so only one
    Demucs pass runs at a time process-wide; concurrent jobs now queue
    instead of racing. This VPS's CPU has no SSE3/SSE4/AVX and would
    thrash badly running two Demucs passes concurrently anyway, so
    serializing is also just the right call for this hardware, independent
    of the hang.
    
    Verified with two remix jobs submitted ~simultaneously via Playwright
    against separate browser contexts - both now complete cleanly instead
    of hanging.
    Co-Authored-By: 's avatarClaude Sonnet 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01BCxXmJVvDFJVHTUi4QgNzi
    83b9fafc
Name
Last commit
Last update
deploy/systemd Loading commit data...
scripts Loading commit data...
src Loading commit data...
tests Loading commit data...
.env.example Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
Dockerfile Loading commit data...
README.md Loading commit data...
docker-compose.yml Loading commit data...
requirements.txt Loading commit data...
setup.sh Loading commit data...