Codeception / Codeception/module-doctrine
Using Doctrine entities as Module arguments causes memory leaks
- Ngôn ngữ chính
- PHP
- Star
- 4
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu bằng cách tìm tài liệu về module Doctrine và phần mô tả các đối số của phương thức module hoặc việc thiết lập fixture. Thêm cảnh báo rằng các entity Doctrine có thể giữ lại các collection persistent và Entity Managers khi được lưu dưới dạng đối số, đồng thời khuyến nghị sử dụng dữ liệu vô hướng khi phù hợp; công việc được xem là hoàn tất khi hướng dẫn này được ghi chép rõ ràng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- php
- Lĩnh vực
- databases, documentation
- Loại issue
- Tài liệu
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100