KB-13E8
GPT Connection — Đóng sự cố CUỐI CÙNG 2026-04-04
2 min read Revision 1
reportGPTconnectionfixclosureroot-causeworkers
GPT Connection — Đóng sự cố CUỐI CÙNG 2026-04-04
Vấn đề: GPT Actions kết nối Agent Data chập chờn — "phiên được phiên không" Nguyên nhân gốc THẬT SỰ: Uvicorn 1 worker + sync blocking → 1 request chậm = toàn server freeze Evidence: 31 nginx upstream timeouts/72h, process freeze 2h12m (Apr 2) Fix cuối cùng: PR #337 — --workers 2 + request timeout 25s Trạng thái: ĐÓNG
Tổng kết 3 lần fix
| Lần | PR | Fix | Đúng gốc? |
|---|---|---|---|
| 1 | #322 | Session readiness gate | ❌ Chỉ gate session-start |
| 2 | #335-336 | Qdrant timeout 15→1s + health re-probe | ⚠️ Giảm latency, chưa fix blocking |
| 3 | #337 | --workers 2 + timeout 25s | ✅ Fix concurrent blocking |
Evidence sau fix cuối
| Chỉ số | Trước | Sau |
|---|---|---|
| Workers | 1 (single) | 2 (concurrent) |
| Concurrent test | Server freeze | PASS (4.6s + 7.9s song song) |
| Upstream timeouts | 31/72h | 0 (expected) |
| Search latency | 6,000-16,000ms | 3,400ms avg |
| Health | degraded (stale) | healthy (Qdrant 8.8ms) |
| Request timeout | Unlimited (block mãi) | 25s → 504 rõ ràng |
Tech debt (không urgent)
- Monitor memory — 2 workers có thể dùng ~800MB/1.5GB limit
- Circuit breaker Qdrant (khi DOWN → PG fallback)
- Gunicorn process manager (thay vì uvicorn standalone — tự restart worker crash)