Bug 1818758

Summary: memory.memsw.limit_in_bytes value does not reflect the limits set in the Deployment Config
Product: OpenShift Container Platform Reporter: mchebbi <mchebbi>
Component: NodeAssignee: Peter Hunt <pehunt>
Status: CLOSED ERRATA QA Contact: Sunil Choudhary <schoudha>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.3.0CC: aos-bugs, dwalsh, jokerman, pehunt, rphillips
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:24:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mchebbi@redhat.com 2020-03-30 09:47:27 UTC
the customer has a process wrapper read the values from:  /sys/fs/cgroup/memory/memory.limit_in_bytes, /sys/fs/cgroup/memory/memory.memsw.limit_in_bytes and calculates Xms and Xmx based on the highest value of those two and JAVA_MAX_MEM_RATIO.

It Works on opc 3.11 but in 4.3 the memory.memsw.limit_in_bytes value does not reflect the limits set in the Deployment Config.
==============================================================
extraction from the deployment config for the pod:

$ oc get dc test-sunny -oyaml | yq .spec.template.spec.containers[0].resources
{
  "limits": {
    "cpu": "1",
    "memory": "1Gi"
  },
  "requests": {
    "cpu": "500m",
    "memory": "512Mi"
  }
==============================================================


oc get dc test-sunny -oyaml | yq .spec.template.spec.containers[0].env
[
  {
    "name": "POD_NAME",
    "valueFrom": {
      "fieldRef": {
        "apiVersion": "v1",
        "fieldPath": "metadata.name"
      }
    }
  },
  {
    "name": "POD_NAMESPACE",
    "valueFrom": {
      "fieldRef": {
        "apiVersion": "v1",
        "fieldPath": "metadata.namespace"
      }
    }
  },
  {
    "name": "JAVA_MAX_MEM_RATIO",
    "value": "40"
  }
]

==============================================================
case ID: 02616909

Comment 2 Peter Hunt 2020-03-30 19:20:57 UTC
I am setting up a PR built on top of the attached PR that will implement this in master. Once that's done, I'll backport it to get it into 4.3

Comment 4 Peter Hunt 2020-05-12 19:30:49 UTC
a PR to fix this has merged into 4.5. I am currently in the process of backporting to 4.4 and 4.3

Comment 9 errata-xmlrpc 2020-07-13 17:24:11 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2409