Bug #54057

Recursive validation validates too deep

Added by Stefan Froemken about 6 years ago. Updated about 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2013-11-28
Due date:
% Done:

0%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Hello Extbase-Team,

I have 2 Domainmodels: Event and Day. It's a MM-Relation. One Event can be at several days and one day there can be several events. Thats why I have defined event.days as LazyObjectStorage and day.events as LazyObjectStorage.
I have debugged the Validator-API and found out that the loop over event.days needs nearly a second.

It validates my event -> days -> all related events incl. my event -> days -> all related events incl. my event -> days -> and so on. Somewhere after many hundreds of loops the validator breaks and returns a valid Result-Object, but all previous validated properties (before days, like: title, eventStart, ...) get lost.

So maybe it would be good to have a cache for already validated objects. They all have a unique identifier spl_hash. So in my opinion it should be possible to implement such a cache.

What do you think about it?

Stefan


Related issues

Related to TYPO3 Core - Bug #53970: getBaseValidatorConjunction is called for simple types Closed 2013-11-26
Related to TYPO3 Core - Task #44391: Remove deprecated stuff in Validation Rejected 2013-01-08

History

#1 Updated by Markus Klein about 6 years ago

Hm sounds more like an endless loop.

So a cache is more a "side effect", it is more a loop detection mechanism.
Is there any prevention from validation loops at all?

Thinking about A.theB = B; B.theA = A;

#2 Updated by Stefan Froemken about 6 years ago

Hello Markus,

I just found it. There is already a cache inside. The cache is only valid for the current CollectionValidator and not for the whole Domainmodel. Here an example:

Day1:
- Event1
- Event2
- Event3

Day2:
- Event1
- Event3
- Event5

Day3:
- Event1
- Event2
- Event4

So, for each day a new Cache will be created. That means, that Event1 will be validated 3 times. Maybe this works good for 1:1 and 1:N, but not for N:M:

Event1:
Day1:
-
Event1
---Day1:
---- Event1
-----Day1-3 again
---- Event2
---- Event3
---Day2:
---- Event1
-----Day1-3 again
---- Event3
---- Event5
---Day3:
---- Event1
-----Day1-3 again
---- Event2
---- Event4
-- Event2
-- Event3
Day2:
-
Event1
---Day1:
---- Event1
-----Day1-3 again
---- Event2
---- Event3
---Day2:
---- Event1
-----Day1-3 again
---- Event3
---- Event5
---Day3:
---- Event1
---- Event2
---- Event4
-- Event3
-- Event5
Day3:
-
Event1
---Day1:
---- Event1
-----Day1-3 again
---- Event2
---- Event3
---Day2:
---- Event1
---- Event3
---- Event5
---Day3:
---- Event1
---- Event2
---- Event4
-- Event2
-- Event4

Issue #53816 helped me a little bit. Defining event.days as ObjectStorage and day.events as LazyObjectStorage stops recursive endless validation.

What do you think to implement a "stopRecursion"-Annotation for Domainmodel-Properties?

Stefan

#3 Updated by Alexander Schnitzler about 6 years ago

Hi Stefan.
We are aware of these problems as Nico de Haen already spent a lot of time with this issue.

I talked to Anja to have another code sprint just for fixing these validation issues in january.

Most probably we will just join the sprint that takes place with all active contributors. Personally I really struggle with analysing the validation api beside my daily work, so I like the idea of letting this issue rest until we find a weekend to handle this issue together.

#4 Updated by Alexander Opitz about 5 years ago

  • Project changed from Extbase MVC Framework to TYPO3 Core
  • Category changed from Extbase: Validation to Extbase
  • Target version changed from 6.2.0 to 7.0
  • TYPO3 Version set to 6.2
  • Is Regression set to No

#5 Updated by Tymoteusz Motylewski almost 5 years ago

sounds like related to https://jira.typo3.org/browse/FLOW-17 Persistence: object tree validation performance is really slow

#6 Updated by Mathias Schreiber almost 5 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)

#7 Updated by Benni Mack over 4 years ago

  • Target version changed from 7.1 (Cleanup) to 7.4 (Backend)

#8 Updated by Susanne Moog over 4 years ago

  • Target version changed from 7.4 (Backend) to 7.5

#9 Updated by Benni Mack about 4 years ago

  • Target version deleted (7.5)

Also available in: Atom PDF