View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002106||Xdebug||Code Coverage||public||2022-07-27 08:23||2022-10-03 07:16|
|OS||Alpine Linux in Docker|
|Summary||0002106: phpunit runs out of memory & runs much more slower than without xdebug|
In my Laravel project I have 1349 tests. I try to run phpunit in a Docker container. Some test are failing, but it's not a problem.
When I start phpunit with this command:
Then I get this output:
I tried to run phpunit without xdebug. In this case it can run all tests and create an error & fail reports as it should be.
I tried to run phpunit pcov instead of xdebug, it can run also without die.
When I run phpunit without --coverage-html option, it't runs smoothly. But with this option it start tests and new dots showing slowly and slowly and then stops showing new dots. But the processor usage grow up to 100%, memory usage also growing up to 100%, then swap is runs out, and then the container dies.
Based on this test cases I think the problem is with xdebug.
Here is my phpunit.dockerfile:
Is there any option to tell phpunit the maximum usable memory size or something other trick to avoid this issue?
PHP version 8.1.6
|Tags||alpine, coverage, crash, Docker, fpm, php8.1|
Yes, that is easy. Dont set the memory limit to -1 as you've done with this docker config line:
But in general, I expect the code to run about 10-20 times as slow, and using a lot more memory. Are you should have you have enough and your machine didn't start swapping?
I tried to remove that line, but then docker died after filled every available memory space. RAM and swap too. So noting difference.
It still seems to me you're simply running out of memory, and there is nothing that I can do about it. Coverage collection takes up quite a lot of memory, specifically when having a complex application.
What do you think, how can I calculate in the future: how many memory I need to run xdebug without any issues?
It's important to know because I use cloud technologies to run my Docker container, and I have possibility to expand memoires as I need.
|2022-07-27 08:23||netdjw||New Issue|
|2022-07-27 08:23||netdjw||Tag Attached: alpine|
|2022-07-27 08:23||netdjw||Tag Attached: coverage|
|2022-07-27 08:23||netdjw||Tag Attached: crash|
|2022-07-27 08:23||netdjw||Tag Attached: Docker|
|2022-07-27 08:23||netdjw||Tag Attached: fpm|
|2022-07-27 08:23||netdjw||Tag Attached: php8.1|
|2022-08-09 09:58||derick||Note Added: 0006352|
|2022-08-09 13:57||netdjw||Note Added: 0006356|
|2022-10-02 15:30||derick||Assigned To||=> derick|
|2022-10-02 15:30||derick||Status||new => resolved|
|2022-10-02 15:30||derick||Resolution||open => not fixable|
|2022-10-02 15:30||derick||Note Added: 0006380|
|2022-10-03 07:16||netdjw||Note Added: 0006385|