Codeception / Codeception/module-doctrine

Using Doctrine entities as Module arguments causes memory leaks

オープン
#15 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
PHP
スター
4
フォーク
2
PR マージ指標
30日以内にマージされた PR はありません

説明

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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず Doctrine モジュールのドキュメントと、モジュールメソッドの引数または fixture のセットアップについて説明しているセクションを見つけます。Doctrine エンティティを引数として保存すると、永続的なコレクションや Entity Managers が保持される可能性があることへの警告を追加し、適切な場合はスカラー値のデータを使用するよう推奨します。ガイダンスが明確に文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
php
領域
databases, documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。