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.
0 comments
muse hub commit comment sha256:b9df9ee377b0e6b17a3d6e37d0073a99d41814cd529372a1b6417dc466932f2d --body "your comment"
No comments yet. Be the first to start the discussion.