Opened 19 years ago
Closed 18 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 , 19 years ago
| Summary: | django.db.models.fill_table_cache → django.db.models.fill_table_cache might dead loop | 
|---|
comment:2 by , 19 years ago
| Keywords: | loop db fill_table_cache foreign key added | 
|---|
comment:3 by , 19 years ago
| Summary: | django.db.models.fill_table_cache might dead loop → django.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 , 19 years ago
| Component: | Cache system → Database wrapper | 
|---|---|
| Owner: | changed from to | 
comment:5 by , 19 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:8 by , 18 years ago
| Keywords: | qs-rf added | 
|---|
comment:9 by , 18 years ago
| Resolution: | → duplicate | 
|---|---|
| Status: | new → closed | 
#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.
    
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: passClicking 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.