Opened 10 years ago
Closed 10 years ago
#24574 closed Bug (needsinfo)
'python manage.py runserver' sleeps forever because of threading lock
Reported by: | Krish | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 1.7 |
Severity: | Normal | Keywords: | threading lock, manage.py |
Cc: | 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 )
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:
- Command line execution starts.
django.core.management:: utility.execute()
- It calls application setup process, where it loads enabled Apps
django.core.management ::jango.setup() django.setup:: apps.populate(settings.INSTALLED_APPS)
- Thread starts threading lock process, so that same application not loaded twice.
django.apps.registry::with self._lock:
- It goes through for each app,
django.apps.registry::app_config.ready() ... # after many lines of codes ... for app_config in self.get_app_configs(): app_config.ready()
- When it matches <AdminConfig: admin>, it calls to
django.contrib.admin.apps:: self.module.autodiscover() django.contrib.admin:: autodiscover_modules('admin', register_to=site)
- autodiscover_modules agains calls django.setup(). I don't have full traceback. But it goes like:
django.core.management ::django.setup()
django.setup::apps.populate(settings.INSTALLED_APPS)
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
Change History (5)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|---|
Summary: | python manage.py runserver sleeps forever → python manage.py runserver sleeps forever because of threading lock |
comment:2 by , 10 years ago
Description: | modified (diff) |
---|
comment:3 by , 10 years ago
Summary: | python manage.py runserver sleeps forever because of threading lock → 'python manage.py runserver' sleeps forever because of threading lock |
---|
comment:4 by , 10 years ago
Description: | modified (diff) |
---|
comment:5 by , 10 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
First, you shouldn't use runserver in production.
Anyway, it seems more likely to be a mistake in your code or configuration as we have many people using Django 1.7 runserver without a problem. Please reopen if you can provide more details about how we can reproduce the problem.