#32066: Sporadic FileNotFoundError on source changes with runserver
-------------------------------------------+------------------------
Reporter: Anton Yanchenko | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | 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 |
-------------------------------------------+------------------------
I'm developing locally with docker-compose and mounted sources to Docker
container as a volume. Sometimes after saving my changes starting to get
`FileNotFoundError` during request. Here is a traceback:
{{{
Environment:
Request Method: POST
Request URL: http://local.dsm.com/e/add/
Django Version: 3.1.1
Python Version: 3.8.5
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'crispy_forms',
'dsm.core',
'dsm.users',
'dsm.events']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware']
Traceback (most recent call last):
File "/opt/venv/lib/python3.8/site-packages/asgiref/sync.py", line 330,
in thread_handler
raise exc_info[1]
File "/opt/venv/lib/python3.8/site-
packages/django/core/handlers/exception.py", line 38, in inner
response = await get_response(request)
File "/opt/venv/lib/python3.8/site-
packages/django/core/handlers/base.py", line 261, in _get_response_async
response = await sync_to_async(response.render,
thread_sensitive=True)()
File "/opt/venv/lib/python3.8/site-packages/asgiref/sync.py", line 296,
in __call__
ret = await asyncio.wait_for(future, timeout=None)
File "/usr/local/lib/python3.8/asyncio/tasks.py", line 455, in wait_for
return await fut
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57,
in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/venv/lib/python3.8/site-packages/asgiref/sync.py", line 334,
in thread_handler
return func(*args, **kwargs)
File "/opt/venv/lib/python3.8/site-
packages/django/template/response.py", line 105, in render
self.content = self.rendered_content
File "/opt/venv/lib/python3.8/site-
packages/django/template/response.py", line 81, in rendered_content
template = self.resolve_template(self.template_name)
File "/opt/venv/lib/python3.8/site-
packages/django/template/response.py", line 63, in resolve_template
return select_template(template, using=self.using)
File "/opt/venv/lib/python3.8/site-packages/django/template/loader.py",
line 42, in select_template
return engine.get_template(template_name)
File "/opt/venv/lib/python3.8/site-
packages/django/template/backends/django.py", line 34, in get_template
return Template(self.engine.get_template(template_name), self)
File "/opt/venv/lib/python3.8/site-packages/django/template/engine.py",
line 143, in get_template
template, origin = self.find_template(template_name)
File "/opt/venv/lib/python3.8/site-packages/django/template/engine.py",
line 125, in find_template
template = loader.get_template(name, skip=skip)
File "/opt/venv/lib/python3.8/site-
packages/django/template/loaders/base.py", line 18, in get_template
for origin in self.get_template_sources(template_name):
File "/opt/venv/lib/python3.8/site-
packages/django/template/loaders/filesystem.py", line 36, in
get_template_sources
name = safe_join(template_dir, template_name)
File "/opt/venv/lib/python3.8/site-packages/django/utils/_os.py", line
17, in safe_join
final_path = abspath(join(base, *paths))
File "/usr/local/lib/python3.8/posixpath.py", line 379, in abspath
cwd = os.getcwd()
Exception Type: FileNotFoundError at /e/add/
Exception Value: [Errno 2] No such file or directory
}}}
After error happened it preserves until I modify sources (python files or
templates) one more time. I'm not exactly sure, but maybe it happens only
if I send request to the server almost immediately after editing file,
unfortunately it's hard to say for sure because sometimes it happens very
occasionally, sometimes quite often (taking into account that Docker
itself could easily occupy a whole core because it's own issues, it could
also interfere to this issue).
https://code.djangoproject.com/ticket/30647 - perhaps this is similar
somehow.
--
Ticket URL: <https://code.djangoproject.com/ticket/32066>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.4d64cd4432558d816742e990951be75a%40djangoproject.com.