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

multiprocessing.cpu_count() is dangerous in containers #5

Open
twosigmajab opened this issue May 2, 2019 · 1 comment
Open

multiprocessing.cpu_count() is dangerous in containers #5

twosigmajab opened this issue May 2, 2019 · 1 comment

Comments

@twosigmajab
Copy link

return (multiprocessing.cpu_count() * 2) + 1

Due to https://bugs.python.org/issue36054, when the above is run inside a container that has been allocated (say) a single core and 512 MB of RAM on a machine with 64 cores, flask-gunicorn thinks it has 64 cores instead of just 1, and spawns 129 workers. This is way more than the container has resources for, and ends up causing out of memory crashes.

@twosigmajab
Copy link
Author

Ref: benoitc/gunicorn#2028 (where this is being propagated from upstream)

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

No branches or pull requests

1 participant