The Wire · Showcase
ASGIREF PLUGS THREAD LEAK AHEAD OF PYTHON 3.14
By RepoJournal · Filed · About Django
Django's async foundation discovered and fixed a critical data leak in Local when running against free-threading builds, the same builds that will power Python 3.14.
The asgiref team uncovered a leak in Local when sys.flags.thread_inherit_context is enabled by default in free-threading builds [1]. This matters because Django's test suite now runs against those builds, catching issues before they hit production. The same PR adds test coverage for free-threading to prevent regressions [1]. In parallel, asgiref dropped Python 3.9 support [2] and merged a critical fix for ThreadSensitiveContext.__aexit__ that was blocking the event loop and deadlocking servers [3]. The __aexit__ method now runs executor.shutdown() off the loop with run_in_executor, keeping the event loop responsive when worker threads need it [3]. The Accessibility Working Group also welcomed SiHyun Lee as a new member [4], continuing Django's push for broader contribution. These are the infrastructure moves that keep async Django safe at scale.
Action items
- → Watch for asgiref release with thread leak fix and free-threading test coverage django/asgiref [monitor]
- → Plan Python 3.9 end-of-life for projects using asgiref django/asgiref [plan]
- → Review your async context handling if you see event loop deadlocks django/asgiref [monitor]
References
- [1] Test free-threading builds and fix Local data leak for thread_inherit_context ↗ django/asgiref
- [2] Dropped support for Python 3.9. ↗ django/asgiref
- [3] Fixed #535: ThreadSensitiveContext.__aexit__ blocking the event loop. ↗ django/asgiref
- [4] Add SiHyun Lee (Antoliny) to Accessibility Working Group ↗ django/dsf-working-groups