[Django] #24574: python manage.py runserver sleeps forever

54 views
Skip to first unread message

Django

unread,
Apr 3, 2015, 6:06:15 AM4/3/15
to django-...@googlegroups.com
#24574: python manage.py runserver sleeps forever
----------------------------+---------------------------------------
Reporter: s2krish | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords: threading lock, manage.py
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+---------------------------------------
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 locking 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 <AdminConfig: admin>, 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 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

--
Ticket URL: <https://code.djangoproject.com/ticket/24574>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 3, 2015, 6:08:57 AM4/3/15
to django-...@googlegroups.com
#24574: python manage.py runserver sleeps forever because of threading lock
-------------------------------------+-------------------------------------

Reporter: s2krish | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: threading lock, | Triage Stage:
manage.py | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by s2krish):

* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0


Old description:

New description:

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

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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24574#comment:1>

Django

unread,
Apr 3, 2015, 6:09:39 AM4/3/15
to django-...@googlegroups.com
#24574: python manage.py runserver sleeps forever because of threading lock
-------------------------------------+-------------------------------------
Reporter: s2krish | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: threading lock, | Triage Stage:
manage.py | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by s2krish:

Old description:

> 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

> 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

New description:

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 <AdminConfig: admin>, 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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24574#comment:2>

Django

unread,
Apr 3, 2015, 6:10:53 AM4/3/15
to django-...@googlegroups.com
#24574: 'python manage.py runserver' sleeps forever because of threading lock
-------------------------------------+-------------------------------------

Reporter: s2krish | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: threading lock, | Triage Stage:
manage.py | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/24574#comment:3>

Django

unread,
Apr 3, 2015, 6:28:56 AM4/3/15
to django-...@googlegroups.com
#24574: 'python manage.py runserver' sleeps forever because of threading lock
-------------------------------------+-------------------------------------
Reporter: s2krish | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: threading lock, | Triage Stage:
manage.py | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by s2krish:

Old description:

> 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 <AdminConfig: admin>, 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

New description:

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 <AdminConfig: admin>, 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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24574#comment:4>

Django

unread,
Apr 3, 2015, 9:07:05 AM4/3/15
to django-...@googlegroups.com
#24574: 'python manage.py runserver' sleeps forever because of threading lock
-------------------------------------+-------------------------------------
Reporter: s2krish | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.7
Severity: Normal | Resolution: needsinfo

Keywords: threading lock, | Triage Stage:
manage.py | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => needsinfo


Comment:

First, you [https://docs.djangoproject.com/en/1.7/ref/django-admin
/#runserver-port-or-address-port shouldn't use runserver in production].

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through
security audits or performance tests. (And that’s how it’s gonna stay.
We’re in the business of making Web frameworks, not Web servers, so
improving this server to be able to handle a production environment is
outside the scope of Django.)

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.

--
Ticket URL: <https://code.djangoproject.com/ticket/24574#comment:5>

Reply all
Reply to author
Forward
0 new messages