id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 24574 'python manage.py runserver' sleeps forever because of threading lock Krish nobody "I have upgraded Django 1.6 o 1.7.7. I was run my project using 'python manage.py runserver' command. It went well in test server. However, when I tried same in production server, it sleeps forever. Detail Server info is attached below. Doing trackback, I figure out problem, It lies on django.apps.registry.populate function. Trace back steps as follows: 1. Command line execution starts. {{{#!python django.core.management:: utility.execute() }}} 2. It calls application setup process, where it loads enabled Apps {{{#!python django.core.management ::jango.setup() django.setup:: apps.populate(settings.INSTALLED_APPS) }}} 3. Thread starts threading lock process, so that same application not loaded twice. {{{#!python django.apps.registry::with self._lock: }}} 4. It goes through for each app, {{{#!python django.apps.registry::app_config.ready() ... # after many lines of codes ... for app_config in self.get_app_configs(): app_config.ready() }}} 5. When it matches , it calls to {{{#!python django.contrib.admin.apps:: self.module.autodiscover() django.contrib.admin:: autodiscover_modules('admin', register_to=site) }}} 56. autodiscover_modules agains calls django.setup(). I don't have full traceback. But it goes like: {{{#!python django.core.management ::django.setup() }}} {{{#!python django.setup::apps.populate(settings.INSTALLED_APPS) }}} {{{#!python django.apps.registry::with self._lock: }}} Application stuck here in django.apps.registry::with self._lock: line because the threading lock has been already acquired and not released. '''Python:''' Python 2.7.6 on both server '''Dev Server:''' Distributor ID: Ubuntu Description: Ubuntu 14.04.1 LTS Release: 14.04 Codename: trusty CPU: 2.40GHz x 1 MemTotal: 1017880kb '''Production Server:''' Distributor ID: Ubuntu Description: Ubuntu 14.04 LTS Release: 14.04 Codename: trusty CPU: 2.00GHz x 24 MemTotal: 4942810" Bug closed Migrations 1.7 Normal needsinfo threading lock, manage.py Unreviewed 0 0 0 0 0 0