Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#19607 closed Bug (fixed)

prefetch_related crash

Reported by: av@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords: prefetch prefetch_related
Cc: marc.tamlyn@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Preston Holmes)

In file django/db/models/query.py line 1613, else statement sould not breaks an iteration, because in some queries obj_list is like [obj1, obj2, obj3] where obj2 has _prefetched_objects_cache, but obj3 has not.

So later in prefetch_one_level() we have "object has no attribute '_prefetched_objects_cache'" error.

Code:

            for obj in obj_list:
                if not hasattr(obj, '_prefetched_objects_cache'):
                    try:
                        obj._prefetched_objects_cache = {}
                    except AttributeError:
                        # Must be in a QuerySet subclass that is not returning
                        # Model instances, either in Django or 3rd
                        # party. prefetch_related() doesn't make sense, so quit
                        # now.
                        good_objects = False
                        break
                else:
                    # We already did this list
                    break    <------ Line 1613 -------------- this one sould be changed to pass

Attachments (1)

django-1.4.4-db-models-query.py.patch (69 bytes ) - added by Anatoly Ivanov 12 years ago.
Patch for db/models/query.py (v.1.4.4)

Download all attachments as: .zip

Change History (28)

comment:1 by Preston Holmes, 12 years ago

Description: modified (diff)
Resolution: needsinfo
Severity: Release blockerNormal
Status: newclosed

From a cursory look - the code for this has not changed between 1.4 and 1.5 - so is unlikely to be a regression, and so not a blocker for 1.5

I haven't yet tried to verify the bug - can you provide more detail on how to recreate the problem query, even better is to provide it in the form of a failing test case.

comment:2 by smyrman, 12 years ago

We have had several errors for this on http://dusken.no while using prefetch related. We have had several bug reports regarding this. The issues is hard to reproduce, but seems most likely to occur after objects have recently been changed in the database (for our case, after someone publishes another video).

On one specific view (http://dusken.no/tv/siste/) We have about 17-18 hits for this error in a period of two months. The daily traffic would be between 100 and 500 visitors for this view, and there are currently no applied HTML caching.

Here is the code we suspect. There are several:

feature_episodes = Episode.objects.filter(is_published=True).order_by('-priority').select_related('season', 'image').prefetch_related('category', 'season__series', 'season__series__category')[:5]

And also:

if category == 'siste':
        episodes = Episode.objects.filter(is_published=True).order_by('-priority', '-public_from').select_related('season', 'image').prefetch_related('category', 'season__series__category')
{{{


Her is the stack trace:


{{{
Traceback (most recent call last):

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/srv/www/www.dusken.no/src/video/series/views.py", line 84, in list
    'feature_episodes': feature_episodes,

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/shortcuts/__init__.py", line 44, in render
    return HttpResponse(loader.render_to_string(*args, **kwargs),

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/loader.py", line 176, in render_to_string
    return t.render(context_instance)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/base.py", line 140, in render
    return self._render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/base.py", line 134, in _render
    return self.nodelist.render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/base.py", line 823, in render
    bit = self.render_node(node, context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/debug.py", line 74, in render_node
    return node.render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/loader_tags.py", line 123, in render
    return compiled_parent._render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/base.py", line 134, in _render
    return self.nodelist.render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/base.py", line 823, in render
    bit = self.render_node(node, context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/debug.py", line 74, in render_node
    return node.render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/loader_tags.py", line 62, in render
    result = block.nodelist.render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/base.py", line 823, in render
    bit = self.render_node(node, context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/debug.py", line 74, in render_node
    return node.render(context)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/template/defaulttags.py", line 145, in render
    len_values = len(values)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/db/models/query.py", line 89, in __len__
    self._prefetch_related_objects()

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/db/models/query.py", line 570, in _prefetch_related_objects
    prefetch_related_objects(self._result_cache, self._prefetch_related_lookups)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/db/models/query.py", line 1680, in prefetch_related_objects
    obj_list, additional_prl = prefetch_one_level(obj_list, prefetcher, attr)

  File "/srv/www/www.dusken.no/DUSKEN/lib/python2.6/site-packages/django/db/models/query.py", line 1808, in prefetch_one_level
    obj._prefetched_objects_cache[cache_name] = qs

AttributeError: 'Series' object has no attribute '_prefetched_objects_cache'
}}}
}}}

by Anatoly Ivanov, 12 years ago

Patch for db/models/query.py (v.1.4.4)

comment:3 by Anatoly Ivanov, 12 years ago

Has patch: set
Resolution: needsinfo
Status: closednew

The issue is hard to reproduce, but it seems to occur more when queryset has nested relations with more than one related object in "child" data set.

Anyway, proposed patch fixes the issue completely, and from quick review it looks like there was either a typo or logical mistake. Fixing it here seems better than spending hours on trying to reproduce it.

Last edited 12 years ago by Anatoly Ivanov (previous) (diff)

comment:4 by Artem Skoretskiy, 12 years ago

Keywords: prefetch_related added
Summary: prefetch_related bugprefetch_related crash

I face the same issue on big data set.

It is crashing every time, so it should be fixed ASAP.

There's an obvious workaround (do not use prefetch_related), but in some of my cases it gives 10x performance drop, so it is no longer an option.

comment:5 by Artem Skoretskiy, 12 years ago

Did a clone with patch applied https://github.com/tonnzor/django/commit/f72483bce99de70380c0ef610f87905cc7812a1d
Also passed pull request https://github.com/django/django/pull/970

Please review and apply them

comment:6 by Marc Tamlyn, 12 years ago

We can't merge this without a test case. The original logic looks sound enough to me, and in any case the correct fix would not be to replace it with a pass, rather remove the else clause all together.

The logic we would be removing is a slight logical optimisation for performance so I don't think applying this fix would break anything, but we should still find out why it's broken as it is.

comment:7 by Marc Tamlyn, 12 years ago

Cc: marc.tamlyn@… added

comment:8 by Luke Plant, 12 years ago

From what I can tell, you are hitting on a case we are deliberately not supporting - a lookup that returns heterogeneous set of objects. At each stage of traversing the prefetch_related chain, the set of objects that are retrieved must be a homogeneous set of objects. If it is not, then you cannot reliably do the next step - the logic that collects the primary key values and does the next lookup assumes you can do the lookup on the same table.

So I deliberately put 'break' there. Also, it is a necessary optimisation to avoid duplicate work in some genuinely possible situations.

Of course, it is possible there is a bug in the logic, and a case I didn't consider, but we need a reproducible test case before we change anything.

comment:9 by av@…, 12 years ago

lukeplant, im submitter

i kill a day to reproduce bug, but it f..'n difficult :)

As i understood, the bug happens, when model has 'self' referenced foreign key, and prefetched that key's related_name set

for example:

class Document(models.Model):
    folder = models.ForeignKey(Folder)
    from_persons = models.ManyToManyField(Person, related_name='documents_from', blank=True, null=True)
    to_persons = models.ManyToManyField(Person, related_name='documents_to', blank=True, null=True)
    doc_request = models.ForeignKey('self', related_name='answers', blank=True, null=True)

Document.objects.all().select_related('doc_request').prefetch_related('answers', 'answers__from_persons', 'answers__to_persons')

and bug occurs in a second iteration of prefetch, when 'answers', that are Document instances too, trying to cache answers__folder instances, such Folder instance hasn't _prefetched_objects_cache
and this is so difficult intersection of 'self' tree, that it will taked a time to check it out.

Next week i'll checked out this 'buggy' object from production database with all relations and try to reproduce bug with failed test.

comment:10 by Luke Plant, 12 years ago

Thanks so much for taking the time to do that av - I realise these things take a long time to debug, and it can seem like we are looking for excuses not to do work, but past experience tells us that we really have to understand the bug before fixing. Thanks for persevering, I'll wait for your test case.

comment:11 by morgan@…, 12 years ago

I can reliably reproduce this error (although I don't know if it's this bug).

Given

class Task(Model):
  category = ForeignKey('Category')
  for_ct = ForeignKey(ContentType)
  for_pk = PositiveIntegerField()
  for = GenericForeignKey(
    content_type_field='for_ct',
    object_id_field='for_pk',
  )

class Thingy(Model):
  tasks = generic.GenericRelation(Task)

I'd like to do

Task.objects.prefetch_related('for__tasks__category')

But I get the error: 'Thingy' object has no attribute '_prefetched_objects_cache'

Task.objects.prefetch_related('for__fk_field_on_thingy') works just fine, as does Thingy.objects.prefetch_related('tasks')

in reply to:  11 comment:12 by Luke Plant, 12 years ago

Replying to morgan@…:

I can reliably reproduce this error (although I don't know if it's this bug).

If you could create a patch with a failing test, that would be a huge help. You need to be able to run the Django test suite, and add your models to tests/prefetch_related/models.py and the tests to tests/prefect_related/tests.py. You can create a new test class if that's easiest e.g. Ticket19607Tests

comment:13 by Neven Munđar, 12 years ago

I've just spent couple of hours trying to create the tests for this case and I've gone through the model examples in this discussion but I wasn't able to reproduce it so if anyone is interested in the issue here are Morgans models (he claims he could reproduce the issue reliably) that should go into tests/prefetch_related/models.py. I've replaced Cathegory FK with Author FK because that is the model that is already available in tests.

class Task(models.Model):
    author = models.ForeignKey('Author')
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')


class Thingy(models.Model):
    tasks = generic.GenericRelation(Task)


You can setup tests/prefetch_related/tests.py like this:

from .models import (... Task, Thingy)

class PrefetchRelatedTests(TestCase):

    def setUp(self):

        # ...

        self.thingy1 = Thingy.objects.create()
        self.task1 = Task.objects.create(author=self.author1,
            content_object=self.thingy1)

        self.thingy2 = Thingy.objects.create()
        self.task2 = Task.objects.create(author=self.author2,
            content_object=self.thingy2)


    def test_ticket_19607_bug(self):
        t = Task.objects.prefetch_related('content_object__tasks__author')


so now you can play around with Thingy/Task models and try to reproduce the bug. You can run a single test with:

./runtests.py --settings=test_sqlite prefetch_related.tests.PrefetchRelatedTests.test_ticket_19607_bug

so maybe this can help if there is somebody who can reproduce the issue, but doesn't know where to start with tests.

comment:14 by kenn.knowles@…, 12 years ago

I have a completely mundane project where I actually have work very hard *not* to trigger this error. It manifests quickly when setting up an admin UI, where lots of ModelAdmin classes need to share each others' prefetch_related lookups.

I do not really have time to isolate a test case now, but a big +1 for this fix. A performance hit is vastly preferable to being unable to use the feature.

comment:15 by Luke Plant, 12 years ago

Thanks kenn - but I'm afraid this is really going nowhere without some understanding of the issue, and if no-one isolates a test case, then we probably will not understand the issue. There is no question that we want to fix it, so an additional +1 tells us nothing.

I'm not trying to be rude, but lots of people saying "Please fix this, but I don't have time to help", doesn't actually help us, it only takes up time reading messages.

If someone comes up with a test case, I'm happy to pledge the time needed to fix it. But I've never seen the error myself.

comment:16 by kenn.knowles@…, 12 years ago

I mean the +1 to add a vote to the severity of the issue, nothing more.

And you are in luck. My admin cannot be performant without fixing this, and there is not apparently any workaround, so I am working on isolating the failure by replicating my project and removing pieces until it is suitable for public upload. Unfortunately a direct replica with a few hand-entered models has not caused the error.

Perhaps you can clarify this statement, which might be a clue:

"From what I can tell, you are hitting on a case we are deliberately not supporting - a lookup that returns heterogeneous set of objects. At each stage of traversing the prefetch_related chain, the set of objects that are retrieved must be a homogeneous set of objects."

My case is probably not that complex, so I doubt it applies

class Person(Model):
   ...

class Relation1(Model):
   person1 = ForeignKey(Person, related_name='relation1_as_person1')
   person2 = ForeignKey(Person, related_name='relation1_as_person2')

class Relation2(Model):
   person1 = ForeignKey(Person, related_name='relation2_as_person1')
   person2 = ForeignKey(Person, related_name='relation2_as_person2')
   relation1 = ForeignKey(Relation1)

And this always crashes, but apparently requires some involved data to trigger:

Relation2.objects.prefetch_related(
    'person1',
    'person2',
    'relation1',
    'relation1__person1',
    'relation1__person2',
    'person1__relation1_as_person1',
    'person2__relation1_as_person2'
)

comment:17 by Luke Plant, 12 years ago

If you could post some example data that triggers it, that would be awesome. Thanks!

From the look of your models, it doesn't sound like my suspicion above was correct, since that could only apply if you were using GenericForeignKey.

comment:18 by flarno11@…, 12 years ago

For me it happens with these models:

from django.db import models

class Lesson(models.Model):
    name = models.CharField(max_length=200)

    def __unicode__(self):
        return self.name

class LessonEntry(models.Model):
    lesson = models.ForeignKey(Lesson)

    def __unicode__(self):
        return self.lesson.__unicode__() + " - " + self.name1 + " - " + self.name2


class WordEntry(models.Model):
    lessonEntry = models.ForeignKey(LessonEntry)
    name = models.CharField(max_length=200)

    def __unicode__(self):
        return self.name + ' (' + self.lang_id + ',' + str(self.id) + ')'

and this query:

>>> from zfvocapp.models import *
>>> WordEntry.objects.filter(lessonEntry__lesson_id=57).prefetch_related('lessonEntry').prefetch_related('lessonEntry__wordentry_set')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/flo/Projects/zfvocapp/zfvocapp/venv/lib/python2.7/site-packages/django/db/models/query.py", line 77, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "/Users/flo/Projects/zfvocapp/zfvocapp/venv/lib/python2.7/site-packages/django/db/models/query.py", line 102, in __iter__
    len(self)
  File "/Users/flo/Projects/zfvocapp/zfvocapp/venv/lib/python2.7/site-packages/django/db/models/query.py", line 94, in __len__
    self._prefetch_related_objects()
  File "/Users/flo/Projects/zfvocapp/zfvocapp/venv/lib/python2.7/site-packages/django/db/models/query.py", line 601, in _prefetch_related_objects
    prefetch_related_objects(self._result_cache, self._prefetch_related_lookups)
  File "/Users/flo/Projects/zfvocapp/zfvocapp/venv/lib/python2.7/site-packages/django/db/models/query.py", line 1746, in prefetch_related_objects
    obj_list, additional_prl = prefetch_one_level(obj_list, prefetcher, attr)
  File "/Users/flo/Projects/zfvocapp/zfvocapp/venv/lib/python2.7/site-packages/django/db/models/query.py", line 1878, in prefetch_one_level
    obj._prefetched_objects_cache[cache_name] = qs
AttributeError: 'LessonEntry' object has no attribute '_prefetched_objects_cache'

but only when larger results are returned. and only with a postgresql database and not with sqlite.

this is the relevant part of the data dump:

CREATE TABLE zfvocapp_lesson (
    id integer NOT NULL,
    "languagePair_id" integer NOT NULL,
    name character varying(200) NOT NULL,
    "createdAt" timestamp with time zone NOT NULL,
    "modifiedAt" timestamp with time zone NOT NULL
);

CREATE TABLE zfvocapp_lessonentry (
    id integer NOT NULL,
    lesson_id integer NOT NULL,
    name1 character varying(200) NOT NULL,
    name2 character varying(200) NOT NULL,
    "createdAt" timestamp with time zone NOT NULL,
    "modifiedAt" timestamp with time zone NOT NULL
);

CREATE TABLE zfvocapp_wordentry (
    id integer NOT NULL,
    "lessonEntry_id" integer NOT NULL,
    name character varying(200) NOT NULL,
    lang_id character varying(2) NOT NULL,
    "createdAt" timestamp with time zone NOT NULL,
    "modifiedAt" timestamp with time zone NOT NULL
);


INSERT INTO zfvocapp_lesson VALUES (57, 2, 'Adjectives', '2013-05-22 20:57:05.105265+00', '2013-05-22 20:57:05.105292+00');

INSERT INTO zfvocapp_lessonentry VALUES (2163, 57, 'jung', 'young', '2013-05-22 20:57:19.760508+00', '2013-05-22 20:57:19.800419+00');
INSERT INTO zfvocapp_lessonentry VALUES (2164, 57, 'schwarz', 'black', '2013-05-22 21:10:43.795717+00', '2013-05-22 21:10:43.842123+00');
INSERT INTO zfvocapp_lessonentry VALUES (2172, 57, 'klein', 'small', '2013-05-22 21:12:27.245094+00', '2013-05-22 21:12:27.281923+00');
INSERT INTO zfvocapp_lessonentry VALUES (2165, 57, 'weiss', 'white', '2013-05-22 21:10:47.624582+00', '2013-05-22 21:10:47.652554+00');
INSERT INTO zfvocapp_lessonentry VALUES (2176, 57, 'glücklich', 'happy', '2013-05-22 21:13:50.657134+00', '2013-05-22 21:13:50.686634+00');
INSERT INTO zfvocapp_lessonentry VALUES (2161, 57, 'neu', 'new', '2013-05-22 20:57:12.437383+00', '2013-05-22 20:57:12.656672+00');
INSERT INTO zfvocapp_lessonentry VALUES (2167, 57, 'rot', 'red', '2013-05-22 21:10:56.728158+00', '2013-05-22 21:10:56.759907+00');
INSERT INTO zfvocapp_lessonentry VALUES (2162, 57, 'alt', 'old', '2013-05-22 20:57:15.962352+00', '2013-05-22 20:57:15.992568+00');
INSERT INTO zfvocapp_lessonentry VALUES (2166, 57, 'blau', 'blue', '2013-05-22 21:10:53.223907+00', '2013-05-22 21:10:53.25234+00');
INSERT INTO zfvocapp_lessonentry VALUES (2173, 57, 'gross', 'big', '2013-05-22 21:12:29.415916+00', '2013-05-22 21:12:29.451332+00');
INSERT INTO zfvocapp_lessonentry VALUES (2168, 57, 'gelb', 'yellow', '2013-05-22 21:11:02.103493+00', '2013-05-22 21:11:02.136576+00');
INSERT INTO zfvocapp_lessonentry VALUES (2169, 57, 'grün', 'green', '2013-05-22 21:11:06.374137+00', '2013-05-22 21:11:06.402334+00');
INSERT INTO zfvocapp_lessonentry VALUES (2170, 57, 'braun', 'brown', '2013-05-22 21:11:10.078453+00', '2013-05-22 21:11:10.106392+00');
INSERT INTO zfvocapp_lessonentry VALUES (2174, 57, 'offen', 'open', '2013-05-22 21:13:03.851302+00', '2013-05-22 21:13:03.878534+00');
INSERT INTO zfvocapp_lessonentry VALUES (2171, 57, 'grau', 'grey', '2013-05-22 21:11:13.454313+00', '2013-05-22 21:11:13.485365+00');
INSERT INTO zfvocapp_lessonentry VALUES (2178, 57, 'wach', 'awake', '2013-05-22 21:14:09.255321+00', '2013-05-22 21:14:09.292234+00');
INSERT INTO zfvocapp_lessonentry VALUES (2175, 57, 'geschlossen', 'closed', '2013-05-22 21:13:08.348016+00', '2013-05-22 21:13:08.376036+00');
INSERT INTO zfvocapp_lessonentry VALUES (2180, 57, 'gesund', 'healthy', '2013-05-22 21:14:28.173758+00', '2013-05-22 21:14:28.199705+00');
INSERT INTO zfvocapp_lessonentry VALUES (2177, 57, 'traurig', 'sad', '2013-05-22 21:13:53.405936+00', '2013-05-22 21:13:53.451009+00');
INSERT INTO zfvocapp_lessonentry VALUES (2179, 57, 'müde', 'tired', '2013-05-22 21:14:11.456667+00', '2013-05-22 21:14:11.484829+00');
INSERT INTO zfvocapp_lessonentry VALUES (2181, 57, 'krank', 'sick', '2013-05-22 21:14:31.414327+00', '2013-05-22 21:14:31.446299+00');
INSERT INTO zfvocapp_lessonentry VALUES (2182, 57, 'nett', 'nice', '2013-05-22 21:15:15.143002+00', '2013-05-22 21:15:15.184282+00');
INSERT INTO zfvocapp_lessonentry VALUES (2183, 57, 'lieb', 'dear', '2013-05-22 21:15:19.547128+00', '2013-05-22 21:15:19.574394+00');
INSERT INTO zfvocapp_lessonentry VALUES (2184, 57, 'schön', 'beautiful', '2013-05-22 21:15:29.416505+00', '2013-05-22 21:15:29.444392+00');
INSERT INTO zfvocapp_lessonentry VALUES (2185, 57, 'schrecklich', 'awful', '2013-05-22 21:15:55.308258+00', '2013-05-22 21:15:55.335381+00');
INSERT INTO zfvocapp_lessonentry VALUES (2186, 57, 'weiblich', 'female', '2013-05-22 21:16:18.967918+00', '2013-05-22 21:16:18.993677+00');
INSERT INTO zfvocapp_lessonentry VALUES (2187, 57, 'männlich', 'male', '2013-05-22 21:16:21.355328+00', '2013-05-22 21:16:21.387481+00');
INSERT INTO zfvocapp_lessonentry VALUES (2189, 57, 'langsam', 'slow', '2013-05-22 21:16:40.855376+00', '2013-05-22 21:16:40.889525+00');
INSERT INTO zfvocapp_lessonentry VALUES (2188, 57, 'schnell', 'quick', '2013-05-22 21:16:37.217384+00', '2013-05-22 21:16:44.05579+00');
INSERT INTO zfvocapp_lessonentry VALUES (2190, 57, 'einfach', 'simple', '2013-05-22 21:17:13.138712+00', '2013-05-22 21:17:13.164846+00');
INSERT INTO zfvocapp_lessonentry VALUES (2191, 57, 'schwierig', 'difficult', '2013-05-22 21:17:16.858922+00', '2013-05-22 21:17:16.886086+00');

INSERT INTO zfvocapp_wordentry VALUES (4379, 2161, 'neu', 'de', '2013-05-22 20:57:12.493735+00', '2013-05-22 20:57:12.493775+00');
INSERT INTO zfvocapp_wordentry VALUES (4380, 2161, 'new', 'en', '2013-05-22 20:57:12.628707+00', '2013-05-22 20:57:12.628734+00');
INSERT INTO zfvocapp_wordentry VALUES (4381, 2162, 'alt', 'de', '2013-05-22 20:57:15.972969+00', '2013-05-22 20:57:15.972995+00');
INSERT INTO zfvocapp_wordentry VALUES (4382, 2162, 'old', 'en', '2013-05-22 20:57:15.987178+00', '2013-05-22 20:57:15.987202+00');
INSERT INTO zfvocapp_wordentry VALUES (4383, 2163, 'jung', 'de', '2013-05-22 20:57:19.782352+00', '2013-05-22 20:57:19.782377+00');
INSERT INTO zfvocapp_wordentry VALUES (4384, 2163, 'young', 'en', '2013-05-22 20:57:19.795058+00', '2013-05-22 20:57:19.795082+00');
INSERT INTO zfvocapp_wordentry VALUES (4385, 2164, 'schwarz', 'de', '2013-05-22 21:10:43.807224+00', '2013-05-22 21:10:43.807249+00');
INSERT INTO zfvocapp_wordentry VALUES (4386, 2164, 'black', 'en', '2013-05-22 21:10:43.834102+00', '2013-05-22 21:10:43.834126+00');
INSERT INTO zfvocapp_wordentry VALUES (4387, 2165, 'weiss', 'de', '2013-05-22 21:10:47.634643+00', '2013-05-22 21:10:47.634688+00');
INSERT INTO zfvocapp_wordentry VALUES (4388, 2165, 'white', 'en', '2013-05-22 21:10:47.64728+00', '2013-05-22 21:10:47.647304+00');
INSERT INTO zfvocapp_wordentry VALUES (4389, 2166, 'blau', 'de', '2013-05-22 21:10:53.233142+00', '2013-05-22 21:10:53.233167+00');
INSERT INTO zfvocapp_wordentry VALUES (4390, 2166, 'blue', 'en', '2013-05-22 21:10:53.246826+00', '2013-05-22 21:10:53.24685+00');
INSERT INTO zfvocapp_wordentry VALUES (4391, 2167, 'rot', 'de', '2013-05-22 21:10:56.738268+00', '2013-05-22 21:10:56.738295+00');
INSERT INTO zfvocapp_wordentry VALUES (4392, 2167, 'red', 'en', '2013-05-22 21:10:56.753734+00', '2013-05-22 21:10:56.753758+00');
INSERT INTO zfvocapp_wordentry VALUES (4393, 2168, 'gelb', 'de', '2013-05-22 21:11:02.115799+00', '2013-05-22 21:11:02.115828+00');
INSERT INTO zfvocapp_wordentry VALUES (4394, 2168, 'yellow', 'en', '2013-05-22 21:11:02.129582+00', '2013-05-22 21:11:02.129605+00');
INSERT INTO zfvocapp_wordentry VALUES (4395, 2169, 'grün', 'de', '2013-05-22 21:11:06.38426+00', '2013-05-22 21:11:06.384285+00');
INSERT INTO zfvocapp_wordentry VALUES (4396, 2169, 'green', 'en', '2013-05-22 21:11:06.397273+00', '2013-05-22 21:11:06.397297+00');
INSERT INTO zfvocapp_wordentry VALUES (4397, 2170, 'braun', 'de', '2013-05-22 21:11:10.088019+00', '2013-05-22 21:11:10.088059+00');
INSERT INTO zfvocapp_wordentry VALUES (4398, 2170, 'brown', 'en', '2013-05-22 21:11:10.10077+00', '2013-05-22 21:11:10.100805+00');
INSERT INTO zfvocapp_wordentry VALUES (4399, 2171, 'grau', 'de', '2013-05-22 21:11:13.464967+00', '2013-05-22 21:11:13.465002+00');
INSERT INTO zfvocapp_wordentry VALUES (4400, 2171, 'grey', 'en', '2013-05-22 21:11:13.47939+00', '2013-05-22 21:11:13.479414+00');
INSERT INTO zfvocapp_wordentry VALUES (4401, 2172, 'klein', 'de', '2013-05-22 21:12:27.254657+00', '2013-05-22 21:12:27.254682+00');
INSERT INTO zfvocapp_wordentry VALUES (4402, 2172, 'small', 'en', '2013-05-22 21:12:27.276567+00', '2013-05-22 21:12:27.276591+00');
INSERT INTO zfvocapp_wordentry VALUES (4403, 2173, 'gross', 'de', '2013-05-22 21:12:29.428584+00', '2013-05-22 21:12:29.42861+00');
INSERT INTO zfvocapp_wordentry VALUES (4404, 2173, 'big', 'en', '2013-05-22 21:12:29.446156+00', '2013-05-22 21:12:29.446179+00');
INSERT INTO zfvocapp_wordentry VALUES (4405, 2174, 'offen', 'de', '2013-05-22 21:13:03.860215+00', '2013-05-22 21:13:03.86024+00');
INSERT INTO zfvocapp_wordentry VALUES (4406, 2174, 'open', 'en', '2013-05-22 21:13:03.872967+00', '2013-05-22 21:13:03.872992+00');
INSERT INTO zfvocapp_wordentry VALUES (4407, 2175, 'geschlossen', 'de', '2013-05-22 21:13:08.35745+00', '2013-05-22 21:13:08.357475+00');
INSERT INTO zfvocapp_wordentry VALUES (4408, 2175, 'closed', 'en', '2013-05-22 21:13:08.370163+00', '2013-05-22 21:13:08.370187+00');
INSERT INTO zfvocapp_wordentry VALUES (4409, 2176, 'glücklich', 'de', '2013-05-22 21:13:50.668264+00', '2013-05-22 21:13:50.668289+00');
INSERT INTO zfvocapp_wordentry VALUES (4410, 2176, 'happy', 'en', '2013-05-22 21:13:50.681382+00', '2013-05-22 21:13:50.681406+00');
INSERT INTO zfvocapp_wordentry VALUES (4411, 2177, 'traurig', 'de', '2013-05-22 21:13:53.415872+00', '2013-05-22 21:13:53.415896+00');
INSERT INTO zfvocapp_wordentry VALUES (4412, 2177, 'sad', 'en', '2013-05-22 21:13:53.444658+00', '2013-05-22 21:13:53.444682+00');
INSERT INTO zfvocapp_wordentry VALUES (4413, 2178, 'wach', 'de', '2013-05-22 21:14:09.265285+00', '2013-05-22 21:14:09.265311+00');
INSERT INTO zfvocapp_wordentry VALUES (4414, 2178, 'awake', 'en', '2013-05-22 21:14:09.285589+00', '2013-05-22 21:14:09.285613+00');
INSERT INTO zfvocapp_wordentry VALUES (4415, 2179, 'müde', 'de', '2013-05-22 21:14:11.467629+00', '2013-05-22 21:14:11.467653+00');
INSERT INTO zfvocapp_wordentry VALUES (4416, 2179, 'tired', 'en', '2013-05-22 21:14:11.479953+00', '2013-05-22 21:14:11.479977+00');
INSERT INTO zfvocapp_wordentry VALUES (4417, 2180, 'gesund', 'de', '2013-05-22 21:14:28.18266+00', '2013-05-22 21:14:28.182686+00');
INSERT INTO zfvocapp_wordentry VALUES (4418, 2180, 'healthy', 'en', '2013-05-22 21:14:28.194698+00', '2013-05-22 21:14:28.194722+00');
INSERT INTO zfvocapp_wordentry VALUES (4419, 2181, 'krank', 'de', '2013-05-22 21:14:31.425494+00', '2013-05-22 21:14:31.425519+00');
INSERT INTO zfvocapp_wordentry VALUES (4420, 2181, 'sick', 'en', '2013-05-22 21:14:31.439754+00', '2013-05-22 21:14:31.439778+00');
INSERT INTO zfvocapp_wordentry VALUES (4421, 2182, 'nett', 'de', '2013-05-22 21:15:15.163646+00', '2013-05-22 21:15:15.16367+00');
INSERT INTO zfvocapp_wordentry VALUES (4422, 2182, 'nice', 'en', '2013-05-22 21:15:15.177561+00', '2013-05-22 21:15:15.177585+00');
INSERT INTO zfvocapp_wordentry VALUES (4423, 2183, 'lieb', 'de', '2013-05-22 21:15:19.557155+00', '2013-05-22 21:15:19.55718+00');
INSERT INTO zfvocapp_wordentry VALUES (4424, 2183, 'dear', 'en', '2013-05-22 21:15:19.569411+00', '2013-05-22 21:15:19.569435+00');
INSERT INTO zfvocapp_wordentry VALUES (4425, 2184, 'schön', 'de', '2013-05-22 21:15:29.426358+00', '2013-05-22 21:15:29.426389+00');
INSERT INTO zfvocapp_wordentry VALUES (4426, 2184, 'beautiful', 'en', '2013-05-22 21:15:29.439535+00', '2013-05-22 21:15:29.439567+00');
INSERT INTO zfvocapp_wordentry VALUES (4427, 2185, 'schrecklich', 'de', '2013-05-22 21:15:55.318041+00', '2013-05-22 21:15:55.318066+00');
INSERT INTO zfvocapp_wordentry VALUES (4428, 2185, 'awful', 'en', '2013-05-22 21:15:55.330489+00', '2013-05-22 21:15:55.330513+00');
INSERT INTO zfvocapp_wordentry VALUES (4429, 2186, 'weiblich', 'de', '2013-05-22 21:16:18.976889+00', '2013-05-22 21:16:18.976914+00');
INSERT INTO zfvocapp_wordentry VALUES (4430, 2186, 'female', 'en', '2013-05-22 21:16:18.988711+00', '2013-05-22 21:16:18.988735+00');
INSERT INTO zfvocapp_wordentry VALUES (4431, 2187, 'männlich', 'de', '2013-05-22 21:16:21.367447+00', '2013-05-22 21:16:21.367472+00');
INSERT INTO zfvocapp_wordentry VALUES (4432, 2187, 'male', 'en', '2013-05-22 21:16:21.380302+00', '2013-05-22 21:16:21.380326+00');
INSERT INTO zfvocapp_wordentry VALUES (4433, 2188, 'schnell', 'de', '2013-05-22 21:16:37.228106+00', '2013-05-22 21:16:37.22813+00');
INSERT INTO zfvocapp_wordentry VALUES (4434, 2188, 'fast', 'en', '2013-05-22 21:16:37.24008+00', '2013-05-22 21:16:37.240104+00');
INSERT INTO zfvocapp_wordentry VALUES (4435, 2189, 'langsam', 'de', '2013-05-22 21:16:40.868826+00', '2013-05-22 21:16:40.868851+00');
INSERT INTO zfvocapp_wordentry VALUES (4436, 2189, 'slow', 'en', '2013-05-22 21:16:40.884681+00', '2013-05-22 21:16:40.884705+00');
INSERT INTO zfvocapp_wordentry VALUES (4437, 2188, 'quick', 'en', '2013-05-22 21:16:44.041216+00', '2013-05-22 21:16:44.041242+00');
INSERT INTO zfvocapp_wordentry VALUES (4438, 2190, 'einfach', 'de', '2013-05-22 21:17:13.147882+00', '2013-05-22 21:17:13.147906+00');
INSERT INTO zfvocapp_wordentry VALUES (4439, 2190, 'simple', 'en', '2013-05-22 21:17:13.159739+00', '2013-05-22 21:17:13.159764+00');
INSERT INTO zfvocapp_wordentry VALUES (4440, 2191, 'schwierig', 'de', '2013-05-22 21:17:16.86852+00', '2013-05-22 21:17:16.868544+00');
INSERT INTO zfvocapp_wordentry VALUES (4441, 2191, 'difficult', 'en', '2013-05-22 21:17:16.881102+00', '2013-05-22 21:17:16.881126+00');

if that doesn't help i can also give you access to the database

comment:19 by Luke Plant, 12 years ago

Thank you kenn, that's brilliant! I have at last been able to reproduce the bug in test case form using this data, and I'll hopefully get it fixed soon.

comment:20 by Luke Plant <L.Plant.98@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 4fd94969d859eb25680a5a52ed482c8f22e5ee15:

Fixed #19607 - prefetch_related crash

Thanks to av@… and flarno11@… for the report.

comment:21 by tswaterman, 11 years ago

thanks! this one was confusing me to no end.

comment:22 by Nate Pinchot, 11 years ago

Any chance this fix will be merged into Django 1.5.2?

comment:23 by Pantelis Petridis, 11 years ago

I would also appreciate merging this fix into Django 1.5.x

comment:24 by Tim Graham <timograham@…>, 11 years ago

In 00b39e0145c5b9117503b20bba74948294a30e5a:

[1.5.x] Fixed #19607 - prefetch_related crash

Thanks to av@… and flarno11@… for the report.

Backport of 4fd94969d8 from master

comment:25 by Ry4an, 11 years ago

I don't suppose anyone's considering backporting this to 1.4? We're not yet ready to upgrade, but running into this in production.

comment:26 by Tim Graham, 11 years ago

Sorry, per our supported versions policy, 1.4 is only receiving security updates at this point.

in reply to:  26 comment:27 by Ry4an, 11 years ago

Replying to timo:

Sorry, per our supported versions policy, 1.4 is only receiving security updates at this point.

Fair enough, thanks.

Note: See TracTickets for help on using tickets.
Back to Top