Changes between Version 1 and Version 2 of Ticket #35757, comment 12
- Timestamp:
- Sep 30, 2024, 11:56:26 AM (5 weeks ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35757, comment 12
v1 v2 1 1 I reproduced this problem with a small Django project. 2 It seems to be related with channels (v3)2 It seems to be related with channels/daphne 3 3 4 Please advise, if Django related (if so, could you reopen the ticket?) 4 As there is a testcase, I re-opened the ticket for re-evaluation. 5 Please advise if more information is required. 5 6 6 I created a new project according the to polls example. The problem occurs when adding 'channels' to `INSTALLED_APPS` (without even using channels).7 I created a new project according the to polls example. The problem occurs when adding 'channels'/'daphne' to `INSTALLED_APPS` (without even using channels). 7 8 8 9 polls.views.py … … 38 39 } 39 40 41 INSTALLED_APPS = [ 42 'daphne', # must be before staticfiles (removing this fixes the problem (with channels 4) 43 'channels', 40 44 41 42 INSTALLED_APPS = [43 45 'django.contrib.admin', 44 46 'django.contrib.auth', … … 47 49 'django.contrib.messages', 48 50 'django.contrib.staticfiles', 49 50 'channels', # adding this line shows the problem, removing this line 'fixes' the problem51 51 ] 52 52 53 54 53 ASGI_APPLICATION = "mysite.asgi.application" # required for channels 55 56 57 54 }}} 58 55 … … 62 59 # 63 60 # do requests in parallel 64 # https://code.djangoproject.com/ticket/3575761 # https://code.djangoproject.com/ticket/35757 65 62 url='http://localhost:8000/polls/' 66 67 63 68 64 curl $url& … … 70 66 curl $url& 71 67 curl $url 68 }}} 72 69 70 == Result 71 Exceptions as shown in original report. (`OSError: [Errno 9] Bad file descriptor`) 72 After a few runs runserver stops serving requests completely, all requests, even sequential ones from a browser, get a 500 with this traceback. 73 74 {{{ 75 Traceback (most recent call last): 76 File "venv/lib/python3.12/site-packages/asgiref/sync.py", line 518, in thread_handler 77 raise exc_info[1] 78 File "venv/lib/python3.12/site-packages/django/core/handlers/exception.py", line 42, in inner 79 response = await get_response(request) 80 File "venv/lib/python3.12/site-packages/asgiref/sync.py", line 518, in thread_handler 81 raise exc_info[1] 82 File "/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 253, in _get_response_async 83 response = await wrapped_callback( 84 File "venv/lib/python3.12/site-packages/asgiref/sync.py", line 468, in __call__ 85 ret = await asyncio.shield(exec_coro) 86 File ".../Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run 87 result = self.fn(*self.args, **self.kwargs) 88 File "/venv/lib/python3.12/site-packages/asgiref/sync.py", line 522, in thread_handler 89 return func(*args, **kwargs) 90 File "mysite/polls/views.py", line 20, in index 91 incr() 92 File "mysite/polls/views.py", line 11, in incr 93 val = cache.incr(key, 1) 94 File "venv/lib/python3.12/site-packages/django/core/cache/backends/memcached.py", line 110, in incr 95 val = self._cache.incr(key, delta) 96 File "venv/lib/python3.12/site-packages/pymemcache/client/hash.py", line 350, in incr 97 return self._run_cmd("incr", key, False, *args, **kwargs) 98 File "venv/lib/python3.12/site-packages/pymemcache/client/hash.py", line 314, in _run_cmd 99 client = self._get_client(key) 100 File "venv/lib/python3.12/site-packages/pymemcache/client/hash.py", line 182, in _get_client 101 raise MemcacheError("All servers seem to be down right now") 102 103 pymemcache.exceptions.MemcacheError: All servers seem to be down right now 73 104 }}} 105 106 107 108 109 == Version info 110 with channels 3 the problem appears (and disappears when removed) when adding 'channels' to INSTALLED_APPS 111 with channels 4 the problem appears when adding 'channels' & 'daphne' to INSTALLED_APPS, disappears when 'daphne' is commented out.