strawberry-graphql / strawberry-django

Strawberry GraphQL Django extension
MIT License
394 stars 115 forks source link

maximum recursion depth exceeded #364

Closed jeemyeong closed 4 weeks ago

jeemyeong commented 10 months ago

Describe the Bug

Error Maximum recursion depth exceeded has occurred when I use DjangoOptimizerExtension

System Information

Additional Context

image

If needed, I'll prepare sample codes that can reproduce these symptoms

Upvote & Fund

Fund with Polar

bellini666 commented 10 months ago

Hi @jeemyeong ,

Indeed it would be nice if you could provide a reproduction example, or at least more details about the issue, like its traceback.

jeemyeong commented 10 months ago

Hi @bellini666 :) Thank you for the response.

# https://github.com/jeemyeong/strawberry-django-bug-report/blob/main/mysite/polls/models.py#L6-L8
class Question(models.Model):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.__original_question_text = self.question_text
        self.__original_pub_date = self.pub_date

This code is an extension of the Django tutorial with four additional lines. Modifying the constructor of a Django model to add custom fields like this can lead to the occurrence of that error.

image
pfcodes commented 1 week ago

@jeemyeong -- how did you resolve this? I'm running into it too

jeemyeong commented 1 week ago

@jeemyeong -- how did you resolve this? I'm running into it too

@pfcodes I decided to give up using the DjangoOptimizerExtension and directly optimized resolvers using dataloader.

patrick91 commented 1 week ago

@pfcodes can you still reproduce it?