Memory Overflow at Doctrine Module with related entities
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 30/100
Piste de recherche
Commencez par le test fonctionnel utilisant persistEntity et grabEntityFromRepository, puis examinez comment le module Doctrine gère les entités avec des relations oneToMany. Comparez les cas TestGroup et TestUser avec le comportement du contrôleur ; le travail est terminé lorsque les entités associées ne produisent plus de sortie récursive ni de dépassement de mémoire.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
If an entity is on the 1 side of a 1:n relationship (i.e. it has oneToMany), and I handle it with the Doctrine Module, the object gets infinitely large, thereby causing a PHP memory overflow.
Details
I've set up these two entities:
AppBundle\Entity\TestGroup:
type: entity
table: test_group
id:
id:
type: integer
generator:
strategy: IDENTITY
fields:
name:
type: string
length: 50
nullable: true
oneToMany:
test_user:
targetEntity: TestUser
mappedBy: test_group
AppBundle\Entity\TestUser:
type: entity
table: test_user
id:
id:
type: integer
generator:
strategy: IDENTITY
fields:
group_id:
type: integer
nullable: true
name:
type: string
length: 50
nullable: true
manyToOne:
test_group:
targetEntity:
inversedBy: test_user
joinColumn:
name: group_id
referencedColumnName: id
Now I run this functional test:
public function tryMemoryLeak (FunctionalTester $I)
{
$group = new \AppBundle\Entity\TestGroup();
var_dump($group);
$I->persistEntity($group);
die;
var_dump($group);
}
Result: The output from var_dump is normal; and the entity exists in the database. But as soon as I remove die; the bug occurs: I get endless (i.e. hundreds or thousands of lines) output in the console. The same happens if I fetch the entity from the database with $I->grabEntityFromRepository.
This explains what I initially observed: If I try to pass the object to some function, I get a memory overflow crash from PHP.
I've tried it with SQLite and PostgreSQL.
If I do the same with the TestUser entity, everything is normal. So I'm figuring it has something to do with the oneToMany setting.
And if I do it in a controller, everything is fine too - so I'm figuring there's no error in the entities.
Setup
- Codeception version: 2.3.5
- PHP Version: 7.1
- Operating System: Windows 10
- Langage dominant
- PHP
- Étoiles
- 4
- Forks
- 2
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Codeception/module-doctrine
-
Difficulté 3/5 1-2 jours Accessibilité débutants 38/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 30/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
Codeception/module-doctrine#2 · 1 commentaire · 1 réaction ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 42/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 64/100
Codeception/module-doctrine#6 · 1 commentaire ·
Toutes les issues de Codeception/module-doctrine
Issues similaires
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
nextcloud/integration_openai#446 ·
-
bug customer-reported
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
MagnaCapax/PMSS#1101 ·
Les mainteneurs répondent en général sous 5 jours
-
InvoiceSettled is answered 200 when the invoice cannot be re-fetched, so BTCPay never redelivers itOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
btcpayserver/woocommerce-greenfield-plugin#93 ·
Les mainteneurs répondent en général sous 1 jour
-
kind/bug status/triage
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
bug medium priority unconfirmed
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
filamentphp/filament#20760 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour