-
Stefy Lanza (nextime / spora ) authored
Under --debug, httpcore emits a connection-close DEBUG trace from the OpenAI client's __del__ finalizer. Under load, that finalizer runs during a GC pause that can land mid-flush of aisbf.log, re-entering the same RotatingFileHandler and raising "RuntimeError: reentrant call inside BufferedWriter". This cascades and blocks the asyncio event loop: uvicorn keeps the port bound (LISTEN, Recv-Q backing up) but stops accepting connections, so the web interface hangs. Pin httpcore/httpx/openai to WARNING regardless of debug mode so a finalizer can never emit a DEBUG/INFO record into the reentrant path. Also removes a large share of the log volume. aisbf's own --debug logging is unaffected. Verified in production: 0 reentrant errors and 0 httpcore DEBUG lines under live load after restart; server stable and responsive. Co-Authored-By:Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1b217f0b