#17014: prefetch_related infinite recursion by default managers -------------------------------------+------------------------------------- Reporter: akaariai | Owner: nobody Type: Bug | Status: closed Component: Database layer | Version: 1.3 (models, ORM) | Resolution: fixed Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 1 Has patch: 0 | Patch needs improvement: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by lukeplant): I agree that having a production machine taken down is bad - what I'm saying is that a unit test for this failure might be virtually useless in stopping that happen, since you would hope that developers would actually run their code before deploying, and it could come with the risk of taking down a developer's machine. There are many things for which automated tests and our testing infrastructure are just not appropriate, and the Halting Problem tells us that is probably one of them. The only way that you can have assurance of termination is by analysis. However, akaariai's solution looks helpful - at least it will provide test coverage of our recursion detection. I will add a test based on that idea, thanks. I'm not so convinced about MAX_PREFETCH_CALLS at this point in time. If there is a case that we are not covering with the current solution, we should think about what that is and try to fix it, not paper over it. If there is definitely a class of cases we cannot fix, we will need a fallback, but we should go through the thought process. There is also the problem of setting the value - 100 could be **way** to high to stop some prefetch_related explosions, depending on the size of the initial query set and the number of related objects. Is there a better heuristic to apply? -- Ticket URL: <https://code.djangoproject.com/ticket/17014#comment:6> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.