Description
Hey y'all, I've been intermittently receiving an error that looks like this:
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File ".../venv/lib/python3.7/site-packages/rest_framework/templatetags/rest_framework.py", line 12, in <module>
from rest_framework.renderers import HTMLFormRenderer
File ".../venv/lib/python3.7/site-packages/rest_framework/renderers.py", line 19, in <module>
from django.test.client import encode_multipart
File ".../venv/lib/python3.7/site-packages/django/test/client.py", line 23, in <module>
from django.test import signals
File "<frozen importlib._bootstrap>", line 980, in _find_and_load
File "<frozen importlib._bootstrap>", line 149, in __enter__
File "<frozen importlib._bootstrap>", line 94, in acquire
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 4512885264
(Ignore the ...
just removing user paths for privacy)
I've tried for awhile to build a test case to make this easier to track down but was unsuccessful. I was able though to successfully make this go away. Here it seems that the django.test.client.encode_multipart
function is being used within renderers.MultiPartRenderer
.
Now re-using code seems fine to me, but I'm a bit hesitant to say that using code designed purely for testing purposes is something that should be done within production code. I've confirmed that copying that function and moving it elsewhere fixes this issue for me (and I've found that I'm not necessarily the only one suffering from this issue as seen here.
Looking at your contribution guide I know it says to talk about the expected behavior rather than code, but it seemed unavoidable to me to make this about the code causing the problem. Would anyone have any suggestions for getting this fixed seeing as it seems kind of tough to reproduce? As an outsider of this project I'd say though that not relying on a function designed for use in testing would be optimal.
I am running django-channels 2.2.0 with Django 2.2.5 at the moment if that helps narrow it down. I mention this because django-channels does replace the default runserver command with its own.