Opened 18 years ago

Closed 17 years ago

#2549 closed defect (duplicate)

django.db.models.fill_table_cache will dead loop if with circular Foreign Keys

Reported by: anonymous Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: critical Keywords: loop db fill_table_cache foreign key, qs-rf
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This function might fall into dead loop if there's a loop in the Foreign Key Relationships.

Change History (9)

comment:1 by anonymous, 18 years ago

Summary: django.db.models.fill_table_cachedjango.db.models.fill_table_cache might dead loop

comment:2 by anonymous, 17 years ago

Keywords: loop db fill_table_cache foreign key added

I find this happens to me (without fail) using this very simple Model:

from django.db import models

class A(models.Model):
    B = models.ForeignKey('B')
    class Admin:
        list_display = ('B',)

class B(models.Model):
    A = models.ForeignKey('A')
    class Admin:
        pass

Clicking on "A" in the Admins Interface loops forever. Clicking on "B" works just fine. I don't know a lot about the internals but I get the feeling that the Admin interface is not the problem, but that "fill_table_cache" is. I would consider changing this to a "Blocker" as this is not that uncommon. If anyone knows where I can find more information on this, please attach it to this ticket.

comment:3 by anonymous, 17 years ago

Summary: django.db.models.fill_table_cache might dead loopdjango.db.models.fill_table_cache will dead loop if with circular Foreign Keys

Ouch! My model was more like A->B, B->C, C->A. Same result.

comment:4 by Adrian Holovaty, 17 years ago

Component: Cache systemDatabase wrapper
Owner: changed from Jacob to Adrian Holovaty

comment:5 by anonymous, 17 years ago

I've opened this 4 month ago, but it's still open!

So I decided I will solve it myself!! I'll use this weekend to make a patch. I've made one 4 month ago but I can't find it now.

comment:6 by anonymous, 17 years ago

Hey Mr. Anon -

Waiting for that patch :)

comment:7 by (none), 17 years ago

milestone: Version 1.0

Milestone Version 1.0 deleted

comment:8 by Malcolm Tredinnick, 17 years ago

Keywords: qs-rf added

comment:9 by Philippe Raoult, 17 years ago

Resolution: duplicate
Status: newclosed

#3288 is a specific case of this but has a patch fixing this issue for both SVN and 0.96. Adding regression tests too.

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