You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some cases when in the function signalify_fetch_all the decorator is called on the already decorated function queryset._fetch_all, causing a recursion depth exception if a fetch all query is invoked many times. This also happens if the query is not actually executed but its cached result is used. The issue can be reproduced through the following Django test:
classTestTheIssue(TestCase):
deftest_n_plus_one_wrapper_error(self):
out= []
# MyModelA has many MyModelB, the relationship is represented adding a # models.ForeignKey field on model B with related name 'my_model_bs'qs=MyModelA.objects.all().prefetch_related('my_model_bs').first()
# Execute this query N times, with N any number that is bigger than the recursion limit, # in my case it is sys.getrecursionlimit() = 1000 foriinrange(2000):
tmp=qs.my_model_bs.all()
out.append(tmp.first())
print(out[-1])
Details
nplusone version: 1.0.0
Django version: 3.2.13
environment: python:3.8.9-slim-buster image for Docker
The text was updated successfully, but these errors were encountered:
There are some cases when in the function
signalify_fetch_all
the decorator is called on the already decorated functionqueryset._fetch_all
, causing a recursion depth exception if a fetch all query is invoked many times. This also happens if the query is not actually executed but its cached result is used. The issue can be reproduced through the following Django test:Details
nplusone version: 1.0.0
Django version: 3.2.13
environment: python:3.8.9-slim-buster image for Docker
The text was updated successfully, but these errors were encountered: