Page MenuHomePhabricator

mwcore-codehealth-patch always failing due to OOM when running PHPUnit tests
Closed, DuplicatePublic

Description

See for instance https://integration.wikimedia.org/ci/blue/organizations/jenkins/mwcore-codehealth-patch/detail/mwcore-codehealth-patch/36148/pipeline/:

+ php -d extension=pcov.so -d pcov.enabled=1 -d pcov.directory=/workspace/src -d 'pcov.exclude=@(tests|vendor)@' -d pcov.initial.memory=2147483648 -d pcov.initial.files=3000 vendor/bin/phpunit --exclude-group Dump,Broken,ParserFuzz,Stub --coverage-clover /workspace/log/clover.xml --log-junit /workspace/log/junit.xml tests/phpunit/unit

+ for signal in "$@"

+ trap 'kill -$signal $cover_pid; wait $cover_pid' SIGTERM

+ wait 422

PHPUnit 8.5.15 by Sebastian Bergmann and contributors.

PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 2147483648 bytes) in /workspace/src/vendor/phpunit/php-code-coverage/src/Driver/PCOV.php on line 40

I think my estimate in T280167 for the initial memory wasn't quite good. The memory usage for the complete mwcore coverage runs has also increased from ~1.5 GB to 3.43 GB. I'm not sure why, since setting the initial size to 2 GB seemed a good guess. The codehealth job also seems to be running phpunit with a memory limit of .5 GB, which might be a bit low.

A few possible solutions:

  1. Remove all pcov.initial.memory args and let it malloc as needed
  2. Remove pcov.initial.memory for the codehealth job (and also any job that doesn't run the whole phpunit suite, since it won't need 2 GB)
  3. Increase the memory limit for phpunit in the codehealth job

2 and 3 are not mutually exclusive.