Codeception / Codeception/module-doctrine

Using Doctrine entities as Module arguments causes memory leaks

Abierto
#15 1 comentario 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
PHP
Estrellas
4
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza por localizar la documentación del módulo Doctrine y la sección que describe los argumentos de los métodos del módulo o la configuración de fixtures. Añade una advertencia de que las entidades de Doctrine pueden conservar colecciones persistentes y Entity Managers cuando se almacenan como argumentos, y recomienda usar datos escalares cuando corresponda; se considera completado cuando la indicación está documentada claramente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
databases, documentation
Tipo de issue
Documentación
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
45/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.