Codeception / Codeception/module-doctrine

Using Doctrine entities as Module arguments causes memory leaks

Offen
#15 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
4
Forks
2
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne damit, die Dokumentation des Doctrine-Moduls und den Abschnitt zu finden, der die Argumente von Modulmethoden oder die Einrichtung von Fixtures beschreibt. Füge eine Warnung hinzu, dass Doctrine-Entitäten persistente Collections und Entity Managers behalten können, wenn sie als Argumente gespeichert werden, und empfehle, wo angemessen skalare Daten zu verwenden; fertig ist die Aufgabe, wenn der Hinweis klar dokumentiert ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
databases, documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.