-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust memory limit check in docker env #14895
base: PHP-8.2
Are you sure you want to change the base?
Conversation
if ($memInfo) { | ||
preg_match('/MemFree:\s+(\d+) kB/', $memInfo, $matches); | ||
return $matches[1] * 1024; // Convert to bytes | ||
// check if running in docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need something similar for other tests:
https://github.com/search?q=repo%3Aphp%2Fphp-src%20proc%2Fmeminfo&type=code
maybe the logic should be extracted for re-use ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it would be even worth it to create a new php-src function which works on docker and regular unix?
that way the php-src tests could be simplified and php userland would also benefit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats both a good idea IMHO, I'll create a separate PR for the other tests, once we have this one settled.
Just tried locally on Ubuntu 20.04 with Docker version 26.1.3 and getting a bit nonsense there:
So not sure if this is always working in Docker... |
Forgot to provide kernel version: |
@bukka could you do me a favour and run with Btw.: 9223372036854771712 represents "no limit" for a 64-bit machine according to https://unix.stackexchange.com/a/421182 |
Yeah this works. So I think this should be just an additional check and not primary check for docker. |
What I mean is that the skip should first check the meminfo and if that is ok, then check the Docker one if on Docker. Would it maybe make sense to not limit on docker but always check |
Hey @bukka, |
ext/standard/tests/file/file_get_contents_file_put_contents_5gb.phpt
Outdated
Show resolved
Hide resolved
Hm, I copied the code already in 9435f4d#diff-8689e5b00cb8d845b3d27ac0094c9342d5cde859d0a6defa39147d23e18459c7R12 before I noticed this PR. |
962218e
to
cc21de4
Compare
7ef1834
to
c4c7421
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it would make sense to introduce section in run-tests for this. It might be more consistent but won't work when run directly so I guess I'm fine with both approaches.
c4c7421
to
eec45d8
Compare
ext/standard/tests/file/file_get_contents_file_put_contents_5gb.phpt
Outdated
Show resolved
Hide resolved
Co-authored-by: Jakub Zelenka <bukka@php.net>
Look at this,
|
I guess that is an issue with the internal buffering and the pipe manager; I would need to check this, but that may take a while (backlog too long). |
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: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:
Related to #13203