[Django] #21049: RuntimeError when running ./manage.py runserver

28 views
Skip to first unread message

Django

unread,
Sep 5, 2013, 4:05:20 PM9/5/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
----------------------------+------------------------
Reporter: lvella@… | Owner: nobody
Type: Bug | Status: new
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------
This happened to me when I tried to "./manage.py runserver":


{{{
$ ./manage.py runserver
Validating models...

Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/core/management/__init__.py", line 397, in
execute_from_command_line
utility.execute()
File "/home/vella/projetos/chroni9/venv/site-
packages/django/core/management/__init__.py", line 390, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/core/management/base.py", line 240, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/core/management/base.py", line 283, in execute
output = self.handle(*args, **options)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/core/management/commands/runserver.py", line 75, in handle
self.run(*args, **options)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/core/management/commands/runserver.py", line 84, in run
autoreload.main(self.inner_run, args, options)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/utils/autoreload.py", line 181, in main
reloader(wrapped_main_func, args, kwargs)
File "/home/vella/projetos/chroni9/venv/site-
packages/django/utils/autoreload.py", line 148, in python_reloader
reloader_thread()
File "/home/vella/projetos/chroni9/venv/site-
packages/django/utils/autoreload.py", line 129, in reloader_thread
if code_changed():
File "/home/vella/projetos/chroni9/venv/site-
packages/django/utils/autoreload.py", line 60, in code_changed
for m in sys.modules.values():
RuntimeError: dictionary changed size during iteration
}}}

I am using Django 1.6b2, with the totally experimental Python 3
implementation from PyPy 2.1, so I can not be sure if this really is a
Django Python 3 issue, just PyPy issue, or PyPy Python 3 issue.

It happened only once, just now, and I was unable to reproduce. I am using
SQLite, if that matters...

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

Django

unread,
Sep 6, 2013, 3:26:00 AM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------

Reporter: lvella@… | Owner: nobody
Type: Bug | Status: new
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* easy: 0 => 1
* stage: Unreviewed => Accepted


Comment:

Right, in Python 3 `values()` returns a dictionary view
(http://docs.python.org/3/library/stdtypes.html#dictionary-view-objects),
not a copy of the values as in Python 2. Probably wrapping
`sys.modules.values()` inside `list()` would be sufficient to ensure
thread-safety.

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

Django

unread,
Sep 6, 2013, 10:44:08 AM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: assigned

Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by mburst):

* owner: nobody => mburst
* status: new => assigned


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

Django

unread,
Sep 6, 2013, 4:32:12 PM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: assigned
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------

Comment (by mburst):

The pull request for this ticket is here
https://github.com/django/django/pull/1575

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

Django

unread,
Sep 6, 2013, 4:36:44 PM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: assigned
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by mburst):

* has_patch: 0 => 1


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

Django

unread,
Sep 6, 2013, 4:37:18 PM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: closed

Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------

Comment (by Andrew Godwin <andrew@…>):

In [changeset:"ce5e09353d4ac3bda10f95e1cc8e609b0b397fdc"]:
{{{
#!CommitTicketReference repository=""
revision="ce5e09353d4ac3bda10f95e1cc8e609b0b397fdc"
Merge pull request #1575 from mburst/ticket_21049

Fixed #21049 -- Fixed autoreload for Python 3
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21049#comment:6>

Django

unread,
Sep 6, 2013, 4:37:17 PM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: closed
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------
Changes (by Max Burstein <mburst@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"559cb826b850faeb7ad198a3a78a38f07dcf3b42"]:
{{{
#!CommitTicketReference repository=""
revision="559cb826b850faeb7ad198a3a78a38f07dcf3b42"


Fixed #21049 -- Fixed autoreload for Python 3

Changed th system module values check to return a list.
In Python 3 it returns a dict_view which could occassionally produce
a runtime error of "dictionary changed size during iteration".
}}}

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

Django

unread,
Sep 6, 2013, 5:32:20 PM9/6/13
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: closed
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"92e89452f1aa3987cb70648e69718c6adea4b079"]:
{{{
#!CommitTicketReference repository=""
revision="92e89452f1aa3987cb70648e69718c6adea4b079"
[1.6.x] Fixed #21049 -- Fixed autoreload for Python 3

Changed th system module values check to return a list.
In Python 3 it returns a dict_view which could occassionally produce

a runtime error of "dictionary changed size during iteration".

Backport of 559cb826b8 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21049#comment:7>

Django

unread,
Feb 12, 2014, 4:26:36 AM2/12/14
to django-...@googlegroups.com
#21049: RuntimeError when running ./manage.py runserver
--------------------------+--------------------------------------
Reporter: lvella@… | Owner: mburst
Type: Bug | Status: closed
Component: Python 3 | Version: 1.6-beta-1
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------+--------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"e0381cdf2e7f677c5b29f2e3351993e92915569a"]:
{{{
#!CommitTicketReference repository=""
revision="e0381cdf2e7f677c5b29f2e3351993e92915569a"
Fixed #22017 -- Prevented RuntimeError on Python 3

Refs #21049. Thanks quinox for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21049#comment:8>

Reply all
Reply to author
Forward
0 new messages