Skip to content

uWSGI running in a Kind cluster on Fedora 33 uses over 8Gi of memory #2175

Closed
@RedRoserade

Description

What happened:

I have a Docker image for a Python web app that runs with uWSGI. If I run it through docker run, everything works fine. However, running the same docker image on a Kind cluster results in the pod, more specifically, uWSGI, to consume >8Gi of memory on boot, even with a minimal example.

The same image can run through docker run with --memory set to under 512M without issues.

This seems to affect only Fedora 33, the same image running on a Kind cluster on an Ubuntu 20.10 machine, with the same Docker version (20.10.5 community) runs as expected.

After some debugging it seems that it only affects uWSGI running with --http, where the extra process for the HTTP server is what's consuming the absurd amounts of memory. If I run it instead with --http-socket, it runs fine, as it doesn't launch a dedicated HTTP server, but this is not equivalent, and is at most a workaround.

When the pod is run with a memory limit set (512Mi), looking at dmesg -T shows the OOM killer being triggered on the HTTP server process (i.e., when running uwsgi --http).

I also tried running this on an OpenShift cluster, with no issues. I also tried destroying and recreating the Kind cluster.

What you expected to happen:

The pod should boot and consume a reasonable amount of memory regardless of operating system.

How to reproduce it (as minimally and precisely as possible):

I created a repository with instructions and dmesg logs, here: https://github.com/RedRoserade/kind-uwsgi-error-example

But, here's some basic instructions (for a manual test):

  • Create a pod spec for a python:3.8-buster image, and kubectl exec -it <pod> -- bash into it.
  • Install, through pip, uwsgi and flask.
  • Create a minimal Flask application, it only needs a single endpoint.
  • Run it through uWSGI with uwsgi --http :8080 --callable <app-variable> --wsgi-file <your-app-file.py>.
  • Try to curl http://localhost:8080. On Fedora 33 curl never succeeds, and dmesg -T shows OOM logs.

Anything else we need to know?:

Not that I'm aware of.

Environment:

  • kind version: (use kind version): 0.10.0
  • Kubernetes version: (use kubectl version): 1.20.5
  • Docker version: (use docker info): 20.10.5
  • OS (e.g. from /etc/os-release): Fedora 33, Kernel 5.11.10-200.fc33.x86_64

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions