Opened 2 years ago

Closed 2 years ago

#33519 closed Bug (wontfix)

Recursive {% include %} crashes silently.

Reported by: Brambor Owned by: nobody
Component: Template system Version: 3.2
Severity: Normal Keywords: template include crash
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

index.html

{% load static %}

{% include "index.html" %}

view:

def index(request, **kwargs):
	template = loader.get_template('index.html')

	return HttpResponse(template.render({}, request))

url(r'^index$', index) is in urlpatterns in urls.py

When running the server with
python manage.py runserver
and accessing http://localhost:8000/index
The server just stops, not printing anything

cmd line looks like this:

>>>python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
February 17, 2022 - 11:33:10
Django version 3.2.12, using settings 'settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

>>>

I also tried python manage.py runserver -v 3, which too didn't print anything.

If I have seen a simple "Ran out of memory" Exception or something, it would occur to me that I did include X in X. Without that error message, I wondered, whether the issue is that something is called index and that word is reserved somewhere.

Change History (1)

comment:1 by Mariusz Felisiak, 2 years ago

Component: Core (Management commands)Template system
Resolution: wontfix
Status: newclosed
Summary: include X in X leads to silent crashRecursive {% include %} crashes silently.
Type: UncategorizedBug

Thanks for the report. On Django 4.0 it crashes with RecursionError: maximum recursion depth exceeded and on Django 3.2 it crashes with:

Fatal Python error: Cannot recover from stack overflow.
Python runtime state: initialized

Current thread 0x00007f8e7a566700 (most recent call first):
....

It seems to have been accidentally improved in 854e9b066850b9b4eb1171966e996322b2c16d27. Unfortunately, Django 3.2 is in extended support and doesn't receive bugfixes anymore (except security issues and data loss bugs).

Note: See TracTickets for help on using tickets.
Back to Top