#33795: Django sync_to_async takes infinite time with asgiref 3.5.1+
-------------------------------------+-------------------------------------
     Reporter:  parfeniukink         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  HTTP handling        |                  Version:  3.2
     Severity:  Normal               |               Resolution:
     Keywords:  asgiref              |             Triage Stage:
  sync_to_async                      |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

 * cc: Andrew Godwin, Carlton Gibson (added)
 * component:  Uncategorized => HTTP handling


Comment:

 Maybe it's probably not related but I noticed that
 `test_request_lifecycle_signals_dispatched_with_thread_sensitive` crashes
 on the `stable/3.2.x` branch with `asgiref` 3.5.1+:

 {{{
 ======================================================================
 ERROR: test_request_lifecycle_signals_dispatched_with_thread_sensitive
 (asgi.tests.ASGITest)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/django/tests/asgi/tests.py", line 240, in
 test_request_lifecycle_signals_dispatched_with_thread_sensitive
     target_thread =
 next(iter(SyncToAsync.single_thread_executor._threads))
 StopIteration

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "/usr/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
     yield
   File "/usr/lib/python3.8/unittest/case.py", line 676, in run
     self._callTestMethod(testMethod)
   File "/usr/lib/python3.8/unittest/case.py", line 633, in _callTestMethod
     method()
   File "/.virtualenvs/django-test-3.8/lib/python3.8/site-
 packages/asgiref/sync.py", line 213, in __call__
     return call_result.result()
   File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in
 result
     return self.__get_result()
   File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in
 __get_result
     raise self._exception
   File "/.virtualenvs/django-test-3.8/lib/python3.8/site-
 packages/asgiref/sync.py", line 279, in main_wrap
     result = await self.awaitable(*args, **kwargs)
 RuntimeError: coroutine raised StopIteration
 }}}

 As far as I'm aware these issues are caused by
 
[https://github.com/django/asgiref/commit/add576498d1e0a7eea8d70b08418d77fecd92f56
 asgiref/add57649], however we will not backport
 36fa071d6ebd18a61c4d7f1b5c9d17106134bd44 so I would restrict supported
 version:
 {{{#!diff
 diff --git a/setup.cfg b/setup.cfg
 index 0f96cf325d..2b6f9b82ef 100644
 --- a/setup.cfg
 +++ b/setup.cfg
 @@ -42,7 +42,7 @@ scripts = django/bin/django-admin.py
  include_package_data = true
  zip_safe = false
  install_requires =
 -    asgiref >= 3.3.2, < 4
 +    asgiref >= 3.3.2, < 3.5.1
      pytz
      sqlparse >= 0.2.2


 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33795#comment:2>
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/01070181857e7c68-68b234ac-94a0-4ebd-b03e-84de6d183924-000000%40eu-central-1.amazonses.com.

Reply via email to