Skip to content

Recursive error handling failure #35151

@timmc-edx

Description

@timmc-edx

On edx.org we're seeing some uncaught errors that are themselves spawning new uncaught errors relating to Mako templates, causing very large stack traces. See samples below. Instances take the form of a series of stack traces:

  • Each stack trace passes through Django's handle_uncaught_exception and then HttpResponseServerError(render_to_string('static_templates/server-error.html', {}, request=request)) as the server tries to serve an error page.
  • As Mako tries to template the navigation bar header, one of two errors occurs.
  • This is then handled as a new uncaught error ("During handling of the above exception, another exception occurred:") and the cycle repeats.

Samples

Recursion Error

A RecursionError due to directly-recursive gettext calls with repetitions in the neighborhood of 850 recursions — growing by 7 on each error-handling iteration: RecursionError.txt

Find more of these in Datadog using span search env:prod service:edx-edxapp-lms @error.message:*RecursionError* -- but note: The error itself is being investigated separately in edx/edx-arch-experiments#674

  File "/tmp/mako_lms/6f79637247faff419ef55a8128bc53da/header/navbar-logo-header.html.py", line 79, in render_body
    context['self'].navigation_logo(**pageargs)
  File "/tmp/mako_lms/6f79637247faff419ef55a8128bc53da/header/navbar-logo-header.html.py", line 134, in render_navigation_logo
    __M_writer(filters.html_escape(filters.decode.utf8(_("{platform_name} Home Page").format(platform_name=static.get_platform_name()))))
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/edx/app/edxapp/venvs/edxapp/lib/python3.11/site-packages/django/utils/translation/__init__.py", line 95, in gettext
    return _trans.gettext(message)
           ^^^^^^^^^^^^^^^^^^^^^^^
[...more calls eventually leading to a gettext loop...]

KeyError

A KeyError involving an Arabic string ("اسم", or "name") while templating a navbar header: KeyError.txt

  File "/tmp/mako_lms/6f79637247faff419ef55a8128bc53da/header/navbar-logo-header.html.py", line 69, in render_body
    __M_writer(filters.html_escape(filters.decode.utf8(_('{name} Dashboard').format(name=enterprise_customer_link.get('name')))))
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'اسم'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions