infection: Infection fails with "Allowed memory size ... exhausted" for a project with a really big coverage
| Question | Answer |
|---|---|
| Infection version | 0.13.2 |
| Test Framework version | PHPUnit |
| PHP version | 7.2 |
| Github Repo | https://github.com/vimeo/psalm |
Extracted from https://twitter.com/sorsoup/status/1140021198765658118
Infection seems to be crashing when I try to run it to check the test suite of Psalm - output at (link: https://circleci.com/gh/bdsl/psalm/232) circleci.com/gh/bdsl/psalm/…
Don’t know if I’m doing anything wrong.
Command line:
php -d memory_limit=12G ~/sites/infection/bin/infection --coverage=build/phpunit --only-covered --threads=4
Output:
____ ____ __ _
/ _/___ / __/__ _____/ /_(_)___ ____
/ // __ \/ /_/ _ \/ ___/ __/ / __ \/ __ \
_/ // / / / __/ __/ /__/ /_/ / /_/ / / / /
/___/_/ /_/_/ \___/\___/\__/_/\____/_/ /_/
Running initial test suite...
PHPUnit version: 7.5.12
1 [============================] < 1 sec
Generate mutants...
Processing source code files: 0/543
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20480 bytes) in /infection/src/TestFramework/PhpUnit/Coverage/CoverageXmlParser.php on line 170
So it fails with when the coverage data is being accumulated in the following lines of the code (depending on how much memory_limit is set
- on
src/TestFramework/PhpUnit/Coverage/CoverageXmlParser.php:170 - on
src/TestFramework/Coverage/CodeCoverageData.php:220
Unfortunately, code coverage takes 2+ hours for Psalm, so here is a compressed archive of needed coverage files: https://www.dropbox.com/s/66tvd0tctfbdki3/phpunit.bz?dl=0 for commit https://github.com/vimeo/psalm/commit/4c57c67e2f1b821e2ef8aa0b00448ff24ce92201
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 33 (33 by maintainers)
Commits related to this issue
- Use coverage report as a primary source of files to mutate This PR is a continuation of #1082. Primary goal of this PR is memory optimization. Fixes #705. With big projects with huge coverage report... — committed to sanmai/infection by sanmai 4 years ago
- Use coverage report as a primary source of files to mutate (#1106) * Use coverage report as a primary source of files to mutate This PR is a continuation of #1082. Primary goal of this PR is memor... — committed to infection/infection by sanmai 4 years ago
we did many changes to run Infection for big projects like Psalm, I don’t think we need to keep it open.
Really big projects can/should run Infection for a diff (modified and/or added files) only
@sanmai Yes, the direct comparison between my branch and Psalm master is https://bit.ly/2Q4LpEx . Only the circleci config file is changed. I had to re-post the comment because the permalink bot is editing the link repeatedly and getting it wrong if I don’t use bit.ly
ok, extracted to https://github.com/infection/infection/issues/1148
we also have another issue related to
ocramius/package-versionsthat might be related https://github.com/infection/infection/issues/876more context for
--no-progresshttps://github.com/infection/infection/pull/1082@sanmai, shouldn’t @bdsl use
--no-progress&--only-coveredto get the maximum of your optimizations?I’ve created a PR with some minor changes that allowed me to run Infection for Psalm with
memory_limit=12Gwithout that fatal error.This is not a final fix, just a few minor (but still useful) improvements.
@bdsl I’m pretty sure, you need to run Infection for Psalm only for changed files. This will dramatically reduce the mutation time. I’m not sure Infection is ready for such many mutations:
You can see how we do it for Infection itself.
The further investigation of what is going on with coverage data is still needed, the issue is not resolved.