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
Fix high memory consumption when using Junit formatter #1423
base: master
Are you sure you want to change the base?
Conversation
The high memory consumption is caused by the formatter keeping many events for the lifetime of a feature. Some events contain references to the BehatContext, resulting in the BehatContext not being dropped. If a feature contains many scenarios/examples and the BehatContext is big, this can lead to OoM errors. This commit drastically reduces the amount of events the Junit formatter keeps and limits the lifetime of those it keeps to the lifetime of an example.
src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
Show resolved
Hide resolved
This PR is still missing a feature (as per the contribution guidelines), I'm not sure however what the best way to test this would be. |
src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
Show resolved
Hide resolved
src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
Outdated
Show resolved
Hide resolved
Thanks @simon-auch |
@stof this seems like it could be merged. |
Will these changes be merged someday? |
Is there anything I can do to help get these changes merged? |
/** | ||
* Extends the current <testsuite> node. | ||
* | ||
* @param array $testsuiteAttributes |
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 suggest adding a more precise type for static analysis: array<string, string|int|null>
src/Behat/Behat/Output/Node/EventListener/JUnit/JUnitFeatureElementListener.php
Outdated
Show resolved
Hide resolved
$event->getFeature()->getFile() | ||
); | ||
|
||
/** @var AfterStepSetup $afterStepSetup */ |
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.
This should be useless thanks to the phpdoc on the property describing the type of items in the array (which is currently described as AfterSetup
, not AfterStepSetup
, so one of the 2 places has an issue IMO.
How can we help solving this issue? |
The high memory consumption is caused by the formatter keeping many events for the lifetime of a feature.
Some events contain references to the BehatContext, resulting in the BehatContext not being dropped.
If a feature contains many scenarios/examples and the BehatContext is big, this can lead to OoM errors.
This commit drastically reduces the amount of events the Junit formatter keeps and limits the lifetime of those it keeps to the lifetime of an example.
This PR fixes #1103