Project

General

Profile

Actions

Bug #54057

closed

Recursive validation validates too deep

Added by Stefan Froemken over 10 years ago. Updated 10 months ago.

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

0%

Estimated time:
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 2 (0 open2 closed)

Related to TYPO3 Core - Bug #53970: getBaseValidatorConjunction is called for simple typesClosed2013-11-26

Actions
Related to TYPO3 Core - Task #44391: Remove deprecated stuff in ValidationRejected2013-01-08

Actions
Actions #1

Updated by Markus Klein over 10 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;

Actions #2

Updated by Stefan Froemken over 10 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

Actions #3

Updated by Alexander Schnitzler over 10 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.

Actions #4

Updated by Alexander Opitz over 9 years ago

  • Project changed from 534 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
Actions #5

Updated by Tymoteusz Motylewski over 9 years ago

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

Actions #6

Updated by Mathias Schreiber over 9 years ago

  • Target version changed from 7.0 to 7.1 (Cleanup)
Actions #7

Updated by Benni Mack almost 9 years ago

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

Updated by Susanne Moog over 8 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #9

Updated by Benni Mack over 8 years ago

  • Target version deleted (7.5)
Actions #10

Updated by Stefan Froemken 10 months ago

  • Status changed from New to Closed

Hello,

I remember that issue, but I have changed day->events (LazyObjectStorage) to day->event (Event model) now, which solves this issue. Further LazyObjectStorages prevents recursive validation in newer TYPO3 systems.

Further I prefer to work with:

public function show(int $event) {
    $event = $this->eventRepository->findByIdentifier($event);
}

That also prevents recursive validation while visiting the detail view.

Closing this issue for now.

Actions

Also available in: Atom PDF