Skip to content
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

Using Doctrine entities as Module arguments causes memory leaks #15

Open
szymach opened this issue Feb 9, 2020 · 0 comments
Open

Using Doctrine entities as Module arguments causes memory leaks #15

szymach opened this issue Feb 9, 2020 · 0 comments

Comments

@szymach
Copy link

szymach commented Feb 9, 2020

Background:

We have a fairly big project using Codeception. Recently, the memory usage during tests reached around ~2 GB of memory, resulting in exceeding the limit on CI test runs.

We have managed to pin down the issue to the fact that we were using Doctrine entities as arguments in a lot of module methods when creating fixture data.

The problem stems from persistent collections - all of them have Entity Manager injected into them and Codeception stores all arguments used in module methods. This caused the old instances of entity manager service not being cleared up and memory usage steadily piling up.

We were not using the Doctrine module, since it was too troublesome due to the persistent EntityManager service.

Solution:

The only way to correctly resolve it was to use scalar data instead of full entities. This has drastically reduced memory usage.

This is not something that I would expect the Codeception team to resolve, but I think that in the section of the Doctrine module you could provide a paragraph or two warning people about this issue. It can save someone folks a lot of work.

Cheers

@Naktibalda Naktibalda transferred this issue from Codeception/Codeception Jan 2, 2021
@TavoNiievez TavoNiievez transferred this issue from Codeception/module-doctrine2 Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant