[php-src] PR #14895: Adjust memory limit check in docker env
| From: | realFlowControl | Date: | Wed, 10 Jul 2024 07:55:37 +0000 |
| Subject: | [php-src] PR #14895: Adjust memory limit check in docker env | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-27164@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/14895
Author: realFlowControl
In a CircleCI environment when running tests in docker and limited to a
medium instance
(4GB memory limit), free and /proc/meminfo are not reflecting the memory
limit of the container, but the host:
```sh
$ cat /proc/meminfo
MemTotal: 71898492 kB
MemFree: 8905616 kB
...
$ free -h
total used free shared buff/cache available
Mem: 68Gi 19Gi 3.0Gi 306Mi 46Gi 48Gi
Swap: 0B 0B 0Bree
```
MemFree in this case with ~8.9GB prevents the execution of the test, but depending on
the order of execution and maybe other jobs on that host, MemFree sometimes is above
the 10GB threshold. This will lead to the test being started and then OOM killed.
So in case we run in docker, we need to check the cgroup memory limit:
```sh
$ cat /sys/fs/cgroup/memory/memory.limit_in_bytes
4294967296
```