MemoryMax not respected in transient .scope with --user option on RHEL8

Solution Verified - Updated -

Issue

  • While trying to limit maximum memory for transient scope created for non-root user to run a comand, its not being respected.

    $ systemd-run --user --scope -p MemoryHigh=0.5G -p MemorySwapMax=0 -p MemoryMax=1G  python3 /home/quickcluster/mem-test.py &
    [1] 22036
    
  • Limits are set properly but OOM killer do not kill the process when it goes beyond the set limit. This is known bug in systemd on RHEL 8.

    $ systemctl --user show run-r5f1e479ed2e8453daf01c18d8fc6a041.scope | grep -i memory
    MemoryHigh=536870912
    MemoryMax=1073741824
    MemorySwapMax=0
    

Environment

  • Red Hat Enterprise Linux 8
  • systemd-239-74.el8_8.x86_64

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content