[Django] #36863: Under WSGI, multiple calls to asgiref.sync.async_to_sync within the same request do not share the same event loop.

1 view
Skip to first unread message

Django

unread,
Jan 14, 2026, 8:20:12 AM (22 hours ago) Jan 14
to django-...@googlegroups.com
#36863: Under WSGI, multiple calls to asgiref.sync.async_to_sync within the same
request do not share the same event loop.
-------------------------------------+-------------------------------------
Reporter: Mykhailo Havelia | Type: Bug
Status: new | Component: HTTP
| handling
Version: 6.0 | Severity: Normal
Keywords: async, wsgi | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Each call creates a new thread with its own event loop. This commonly
happens in middlewares and signals, causing a single request to spawn
multiple threads and event loops, which is unnecessary and prevents reuse
of async resources.

This could be addressed by introducing a per-request async context, for
example as shown in this draft implementation:
https://github.com/Arfey/django/pull/5/changes
--
Ticket URL: <https://code.djangoproject.com/ticket/36863>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 14, 2026, 10:35:13 AM (20 hours ago) Jan 14
to django-...@googlegroups.com
#36863: Under WSGI, multiple calls to asgiref.sync.async_to_sync within the same
request do not share the same event loop.
----------------------------------+--------------------------------------
Reporter: Mykhailo Havelia | Owner: (none)
Type: Bug | Status: new
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: async, wsgi | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Flavio Curella):

* cc: Flavio Curella (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/36863#comment:1>

Django

unread,
4:48 AM (1 hour ago) 4:48 AM
to django-...@googlegroups.com
#36863: Under WSGI, multiple calls to asgiref.sync.async_to_sync within the same
request do not share the same event loop.
----------------------------------+--------------------------------------
Reporter: Mykhailo Havelia | Owner: (none)
Type: Bug | Status: new
Component: HTTP handling | Version: 6.0
Severity: Normal | Resolution:
Keywords: async, wsgi | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Comment (by Kundan Yadav):

hey can i work on this issue ?
--
Ticket URL: <https://code.djangoproject.com/ticket/36863#comment:2>
Reply all
Reply to author
Forward
0 new messages