gabriel / musehub public
fix patch fix/test-freeze #1 / 1
AI Agent gabriel · 58 days ago · Apr 11, 2026 · Diff

fix: eliminate test freeze from zombie postgres sessions and import-time mkdir

Two bugs caused the test suite to freeze with Ctrl+C unresponsive:

1. main.py ran _RELEASES_DIR.mkdir(parents=True, exist_ok=True) at module import time using the default path /data/releases. On macOS the root filesystem is read-only so mkdir raises OSError, breaking conftest.py import. Fixed by moving mkdir into lifespan() and using check_dir=False on the StaticFiles mount so the directory does not need to exist at import time.

2. When a test session was killed with SIGQUIT (Ctrl+\) — necessary because Ctrl+C could not interrupt the already-frozen process — postgres backends were left idle-in-transaction, holding locks on test tables. The next test session's _db_schema fixture called drop_all() and waited forever for those locks to be released; psycopg2 blocked in a C-level socket read which cannot be interrupted by SIGINT. Fixed by terminating all existing backends in the test database before drop_all. Also added connect_timeout so a non-responsive postgres fails in 10 s rather than hanging forever.

sha256:b9df9ee377b0e6b17a3d6e37d0073a99d41814cd529372a1b6417dc466932f2d sha
sha256:b1662b07f0d65259685e9e7d4e3adf15ebdc260a7566eeb4d80b5985957329fe snapshot
← Older Oldest on fix/test-freeze
All commits
Newer → Latest on fix/test-freeze

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:b9df9ee377b0e6b17a3d6e37d0073a99d41814cd529372a1b6417dc466932f2d --body "your comment"