Opened 9 years ago

Last modified 5 weeks ago

#26214 closed Cleanup/optimization

Better error message for RuntimeError: populate() isn't reentrant — at Version 1

Reported by: Thomas Güttler Owned by:
Component: Core (Other) Version: dev
Severity: Normal Keywords:
Cc: Aymeric Augustin Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Thomas Güttler)

We were hit by an exception like this in production environment

Traceback (most recent call last):
  File "foobar-fm/foobar_fm/apache/django_wsgi.py", line 4, in <module>
    application = wsgi.get_handler()
  File "djangotools/djangotools/utils/wsgi.py", line 54, in get_handler
    return get_wsgi_application()
  File "lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
    django.setup()
  File "lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "lib/python2.7/site-packages/django/apps/registry.py", line 78, in populate
    raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant

To debug this, I am missing an very important part:

The Stacktrace of the other one trying to load the config

Here is the code part

            # app_config should be pristine, otherwise the code below won't
            # guarantee that the order matches the order in INSTALLED_APPS.
            if self.app_configs:
                raise RuntimeError("populate() isn't reentrant")

My idea: the first one, who passes above check stores its current stracktrace to a variable.

The if the second fails, and RuntimeError("populate() isn't reentrant") gets executed, the exception can show the stacktrace of the first run.

With this you can debug it. Otherwise you are lost.

What do you think?

Change History (1)

comment:1 by Thomas Güttler, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top