Author christian.heimes
Recipients asvetlov, caarlos0, christian.heimes
Date 2020-11-20.20:27:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605904027.42.0.752154132991.issue42411@roundup.psfhosted.org>
In-reply-to
Content
Even if we would decide to add a memory limit based on cgroups, there is no way to implement a limit in Python correctly. We rely on the platforms malloc() implementation to handle memory allocation for us.

Python has an abstraction layer for memory allocator, but the allocator only tracks Python objects and does not keep information about the size of slabs. Memory tracking would increase memory usage and decrease performance. It would also not track other memory like 3rd party libraries, extension modules, thread stacks, and other processes in the same cgroups hierarchy.

I'm pretty sure that the RLIMIT_AS approach will not work if you run multiple processes in the same container (e.g. spawn subprocesses).

I'll talk to our glibc and container experts at work next week. Perhaps they are aware of a better way to handle cgroups memory limits more gracefully.
History
Date User Action Args
2020-11-20 20:27:07christian.heimessetrecipients: + christian.heimes, asvetlov, caarlos0
2020-11-20 20:27:07christian.heimessetmessageid: <1605904027.42.0.752154132991.issue42411@roundup.psfhosted.org>
2020-11-20 20:27:07christian.heimeslinkissue42411 messages
2020-11-20 20:27:06christian.heimescreate