You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(tv): synchronize requests.Session and CookieJar access across concurrent threads #73
TVClient shares a single requests.Session (self._s) across ScreenerWorker, TapeWorker, NewsPrefetcher, tv-auth-check, and multi-threaded WSGI HTTP request handlers. set_cookies() calls self._s.cookies.clear() and .set(...) under self._lock, while HTTP calls (scan, headlines, story, check_auth, get_watchlists, add_to_watchlist) access self._s without synchronization. requests.Session and RequestsCookieJar are not thread-safe, risking RuntimeError: dictionary changed size during iteration and pool corruption.
Run NewsAlerts during active polling across Screener, Tape, and NewsPrefetcher.
Save Settings repeatedly to invoke TVClient.set_cookies() while scans are in flight.
Observe concurrent mutation of self._s.cookies while worker threads iterate the shared CookieJar.
Expected Behavior
TVClient should use thread-local requests.Session instances (or pass immutable per-request cookie dicts copied under self._lock) so no thread mutates a shared CookieJar during active requests.
Operating System & Version
OS: Windows 11 x64 / macOS arm64 / Linux x86_64
Version: v2.12.0
Display / Scale: Verified via live Chrome CDP (1600x960) & local unit/backend suite
Summary of Changes: Replaced TVClient's shared requests.Session in app/tv_client.py with cookie-versioned thread-local sessions (threading.local()), eliminating concurrent CookieJar mutation races. Verified via multi-threaded unit test.
Verification: compileall clean, 84/84 unit tests passing (including tests/test_audit_fixes.py), and live Chrome CDP verification passed.
This issue will automatically close upon PR #82 review and merge into main.
Activity
mlgitdev commentedon Dec 2, 2026
🚀 Resolution In Progress
A fix for this issue has been implemented and submitted in Pull Request #82 (
v2.12.1).fix/audit-remediation-67TVClient's sharedrequests.Sessioninapp/tv_client.pywith cookie-versioned thread-local sessions (threading.local()), eliminating concurrentCookieJarmutation races. Verified via multi-threaded unit test.compileallclean, 84/84 unit tests passing (includingtests/test_audit_fixes.py), and live Chrome CDP verification passed.This issue will automatically close upon PR #82 review and merge into
main.github-actions commentedon Dec 2, 2026
✅ Issue Validation Passed
fix(tv))This issue is well-structured and ready for work according to the Issue-First Protocol.