New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: maximum recursion depth exceeded #1034
Comments
How can I fix this bug? |
@fatelei you can set in the post_fork hook the recursion limit using sys.setrecursionlimit @tilgovi @berkerpeksag what do you think about increasing it in the tornado worker directly? |
I'm not familiar with both gunicorn/sock.py and Tornado, but I think we shouldn't play with sys.setrecursionlimit. Recursive error is probably sign of a bug in Gunicorn. Perhaps something like def __getattr__(self, name):
if name == 'sock':
raise AttributeError
return getattr(self.sock, name) would work (didn't tested). |
@fatelei could you please paste the full traceback? |
If |
@berkerpeksag right! the change looks OK for me. We should have a way to reproduce it though |
I have figured out the reason. When gunicorn graceful restarts the worker, in tornado ioloop there is a
But the
When gunicorn graceful reloads, this sock has been setted to None. Call Maybe, the code can be changed to:
|
Sounds good. Open a pull request and let's get this fixed. |
Thanks for the investigation. |
I find pull-1033 will fix this bug. it ensure when server close the socket, the ioloop will not occur I will close this issue, when gunicorn-19.4 is released. Thanks everyone. |
Fixed by d9b8959. |
Work gunicorn with tornado,when tornado server worker accpet a new connection it sometimes will lead to
RuntimeError: maximum recursion depth exceeded
.The gunicorn always calls the code below until reaches the maximum recursion depth:
Related package version:
The text was updated successfully, but these errors were encountered: