Bug #48093

AbstractCompositeValidators memory consumption continuously grow

Added by Tarcisio Fedrizzi about 8 years ago. Updated almost 8 years ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Validation
Start date:
2013-05-09
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
Yes
Complexity:
easy

Description

Hi,
there is a problem in the way AbstractCompositeValidators passes the validatedInstacesContainer to its children.

The code of the addValidator method says:

  98         public function addValidator(\TYPO3\Flow\Validation\Validator\ValidatorInterface $validator) {
  99                 if ($validator instanceof ObjectValidatorInterface) {
 100                         $validator->setValidatedInstancesContainer = $this->validatedInstancesContainer;
 101                 }
 102                 $this->validators->attach($validator);
 103         }

this is wrong because it overwrites the setValidatedInstancesContainer method of the attached validators. Moreover the code doesn't pass the validatedInstancesContainer down to the validators it contains. This causes the contained validators to create their personal instance of validatedInstancesContainer that keeps growing. This renders impossible to work on big collections of objects due to excessive memory consumption.

In the attached patch I moved the correct version of this code to the validate methods of ConjuntionValidator and DisjunctionValidator. I think that it would be safe to pass the validatedInstancesContainer in the setValidatedInstancesContainer of AbstractCompositeValidators. However given that the resolution of validator could be made more dynamic I preferred calling the setValidatedInstancesContainer just before the validation of CompositeValidators children in the validate method.

Regards,
Tarcisio Fedrizzi.


Files


Related issues

Has duplicate TYPO3 Flow Base Distribution - Bug #48083: AbstractCompositeValidator validatedInstancesContainer grows continuoslyClosed2013-05-09

Actions
#1

Updated by Tarcisio Fedrizzi about 8 years ago

Hi,
there is an error with the patch when $this->validatedInstancesContainer is not set. I've attached a new version of the patch where I check for the variable to be set before assigning it to the children.

Regards,
Tarcisio Fedrizzi.

#2

Updated by Tarcisio Fedrizzi almost 8 years ago

Hi,
sorry I've seen that I have reattached the same patch as in the first post.

Here it is the correct one.

Sorry,
Regards,
Tarcisio Fedrizzi.

#3

Updated by Robert Lemke almost 8 years ago

  • Target version set to 2.0.1

Also available in: Atom PDF