8000 `scheduledForSynchronization` leaks memory when using `@ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")` · Issue #7629 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
scheduledForSynchronization leaks memory when using @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT") #7629
Closed
@yethee

Description

@yethee

Bug Report

scheduledForSynchronization not erases when no changes on the flush.

Q A
BC Break yes/no
Version 2.6.3

Summary

I use DEFERRED_EXPLICIT policy for entities in my app. And app crashes with out of memory error during batch processing. Because scheduledForSynchronization keeps references to entities when no changes for commit:

return; // Nothing to do.

In this case UnitOfWork::postCommitCleanup() not called.

How to reproduce

use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 * @ORM\ChangeTrackingPolicy("DEFERRED_EXPLICIT")
 */
class Entity
{
}

$entity = $em->find(Entity::class, 123);

$em->persist($entity);
$em->flush();
$em->detach($entity);

var_dump($em->getUnitOfWork()->size()); // int(0)
var_dump($em->getUnitOfWork()->isScheduledForDirtyCheck($entity)); // bool(true)

Was expected that isScheduledForDirtyCheck() return false after commit (flush) in any case.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0