Skip to content
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

eventlet worker class conflicts with gunicorn preload #7131

Closed
iamareebjamal opened this issue Jul 11, 2020 · 1 comment
Closed

eventlet worker class conflicts with gunicorn preload #7131

iamareebjamal opened this issue Jul 11, 2020 · 1 comment

Comments

@iamareebjamal
Copy link
Member

Several issues have previously been caused due to eventlet worker which changes blocking I/O to non-blocking by monkey patching (see fossasia/open-event-frontend#4544), greatly increasing the concurrency of the server. To fix the bugs, we previously disabled eventlet worker as a workaround. But the performance of the server decreased so we re-enabled it after verifying that previous issues aren't happening.

The core cause of the issues is recursion error: eventlet/eventlet#371

  File "/home/iamareebjamal/.pyenv/versions/3.7.7/lib/python3.7/ssl.py", line 518, in options
    super(SSLContext, SSLContext).options.__set__(self, value)
  [Previous line repeated 468 more times]
RecursionError: maximum recursion depth exceeded while calling a Python object

After debugging, we found out that gunicorn preload mode is incompatible with async workers which require money patching before any code is run. This is because preload option runs the application code first and then forks it into multiple processes. This saves memory but obviously prevents monkey patching from happening earliest in the bootstrapping process. So, we need to configure the server so that preload flag is configurable and after benchmarking, we'll conclude whether to remove preload and allow eventlet for speed at the cost of memory or remove eventlet and allow preload for memory at the cost of speed. For now, we'll just remove eventlet worker as a workaround, yet again

@iamareebjamal
Copy link
Member Author

iamareebjamal commented Nov 16, 2020

This was fixed in multiple PRs and now we're using gevent instead of eventlet #7446

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants