#32173: Autoreloader doesn't work with asyncio. ------------------------------------------+------------------------ Reporter: Carlton Gibson | Owner: nobody Type: New feature | Status: new Component: Utilities | Version: 3.1 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | ------------------------------------------+------------------------ This is a follow-up to a [https://forum.djangoproject.com/t/feasibility- of-using-subprocess-for-auto-reloader/4970/7 discussion on the forum about the feasibility of using subprocess, rather than threads for the autoreloader].
The summary is that because of the way the autoreloader uses threading, it's not compatible with (most.many uses) of asyncio. (We end up trying to use the event loop from the main thread on the child thread, which Doesn't Workâ˘). This [https://github.com/django/channels/issues/1374 originally surfaced on Channels], we [https://github.com/django/daphne/pull/294 tried to fix it in Daphne], but this has lead to other issues, and we're going to have to revert that. Other Channels users, looking at removing the dependency on Daphne there, have [https://github.com/django/channels/issues/490#issuecomment-720252418 reported needing to re-implement reloading due to the threading behaviour]. Ultimately I think we have to resolve the threading issue in Django itself. On the forum thread, Tom suggested that we might look into leveraging ''Hupper'' here. Assuming that would solve the threading issues (which seems like an empirical question just yet) I guess there'd need to a discussion about making that a required dependency or not, but it might be nice to settle on a solution here that's support more widely than just in Django. -- Ticket URL: <https://code.djangoproject.com/ticket/32173> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/056.c903cc735bb16a6952733700f4a69760%40djangoproject.com.