Review main Merged

50953[BUGFIX] Optimize cache handling in ReflectionService

Stefan Rotsch CR +2 V +2 Easy +18 −7 updated 12/15/16, 23:11

Commit message

Method reflection objects are used temporarily to extract information
from methods. This information is eventually stored in the cache.
However the method reflection objects themselves must stay outside the cache
because they cannot be serialized. They also do not provide much value
as the information is stored in the cache anyway.
The only additional info these reflections provided is whether a method
existed or not in the class, which we now also cache as plain array.

Furthermore the information whether cache relevant properties were
updated and the cache needs to be saved again is now reset once it was
written. This ensures that the cache is only written once even the
ReflectionService is used multiple times.

Review

  • Code review CR +2
    • Markus Klein +2
    • Stefan Rotsch +1
    • Tymoteusz Motylewski +1
  • Verified V +2
    • Markus Klein +2
    • Stefan Rotsch +1
    • Tymoteusz Motylewski +1
    • TYPO3com +1 CI

Issues 2

Files 1

Review log 2936

Show 911 earlier messages
  1. Stefan Rotsch uploaded patch set 1 12/13/16, 22:44

  2. TYPO3com voted on patch set 1 V -1 12/13/16, 22:48 Completed build in 03m 36s on Tue, 13 Dec, 11:48 PM Test Summary: 54393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5749

  3. Markus Klein commented on patch set 1 12/13/16, 23:29

    affects 7.6 too, at least!
  4. Stefan Rotsch uploaded patch set 2 12/14/16, 08:47

  5. TYPO3com voted on patch set 2 V +1 12/14/16, 08:51 Completed build in 03m 51s on Wed, 14 Dec, 09:51 AM Test Summary: 54393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5751

  6. Wouter Wolters commented on patch set 2 12/14/16, 09:30

    ReflectionServiceTest.php:49

    needs to be protected.

    ReflectionServiceTest.php:53

    we should use the ::class construct here in makeInstance and objectmanager

    ReflectionServiceTest.php:68

    ::class

    ReflectionServiceTest.php:72

    We need to use the doctrine API here. databaseConnection is deprecated.

    ReflectionServiceTest.php:84

    ::class
  7. Xavier Perseguers voted on patch set 2 V +1 12/14/16, 09:58

  8. Oliver Klee commented on patch set 2 12/14/16, 12:06

    MethodReflection.php:33

    I propose adding a PHP 7 return type.
  9. Andreas Kienast commented on patch set 2 12/14/16, 12:13

    MethodReflection.php:33 Reply

    I suggest not to do this for bugfixes that are intended to get backported.
  10. Markus Klein commented on patch set 2 12/14/16, 12:43

    Do we backport the tests as well? Otherwise I would make this file PHP7 strict
  11. Helmut Hummel commented on patch set 2 12/14/16, 12:55

    ReflectionServiceTest.php:72 Reply

    We shouldn't look into the database at all, but find a way to assert a cache entry has been created
  1. Helmut Hummel commented on patch set 2 12/14/16, 12:57

    ReflectionServiceTest.php:72 Reply

    or remove these assertions completely
  2. Stefan Rotsch uploaded patch set 3 12/14/16, 17:24

  3. TYPO3com voted on patch set 3 V +1 12/14/16, 17:28 Completed build in 03m 48s on Wed, 14 Dec, 06:28 PM Test Summary: 54393 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5757

  4. Stefan Rotsch commented on patch set 2 12/14/16, 17:29

    I've addressed Wouters comments (sorry, the project I'm on is still based on 6.2, so there is a lot of new stuff for me to learn) Regarding Helmuts comments, I agree it is not ideal to check for the creation of a cache record by looking into the DB. Have to think about how to modify the test…
  5. Helmut Hummel commented on patch set 3 CR -1 V -1 12/14/16, 23:20

    MethodReflection.php:35

    this is definitely wrong! __sleep must return an array of properties not a string. this completely breaks serialization of these objects
  6. Helmut Hummel commented on patch set 3 12/14/16, 23:41

    btw. your patch works because the serialization is invalid and an unserialize returns null, thus the reflection service builds a new object. This is not a solution. we must either find out why the objects are broken after unserialize or remove the reflection change again and see how to avoid duplicate caching otherwise
  7. Helmut Hummel commented on patch set 3 CR -2 12/14/16, 23:57

    We need to revert the patch that caused the troubles and find another solution for the problem
  8. Helmut Hummel uploaded patch set 4 12/15/16, 00:39

  9. Helmut Hummel commented on patch set 4 CR 0 12/15/16, 00:40

    I re-wrote the reflection service to fix both issues at hand please carefully test and the backport to the other branches
  10. TYPO3com voted on patch set 4 V +1 12/15/16, 00:44 Completed build in 04m 14s on Thu, 15 Dec, 01:44 AM Test Summary: 54391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5772

  11. Helmut Hummel uploaded patch set 5 12/15/16, 00:51

  12. TYPO3com voted on patch set 5 V -1 12/15/16, 00:55 Completed build in 03m 34s on Thu, 15 Dec, 01:55 AM Test Summary: 1162 of 54391 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5773

  13. Markus Klein commented on patch set 5 12/15/16, 01:23

    composer.lock needs to be updated I guess (composer.json hash)
  14. Markus Klein commented on patch set 5 CR -1 12/15/16, 01:26

    ReflectionService.php:319

    by reading this change is not necessary, I would say.

    ReflectionService.php:575

    can you explain why this is always needed?

    frontend.php:33

    test-code that should go away I guess
  15. Helmut Hummel commented on patch set 5 12/15/16, 02:11

    ReflectionService.php:319 Reply

    true, it just alligns with the other code

    ReflectionService.php:575 Reply

    creating a reflection might cause an exception, which still needs to cause the cache to be re-written. also this is called from several places and every time it is called, the cache needs update. check the calling code

    frontend.php:33 Reply

    Done
  16. Helmut Hummel uploaded patch set 6 12/15/16, 02:11

  17. TYPO3com voted on patch set 6 V +1 12/15/16, 02:15 Completed build in 04m 16s on Thu, 15 Dec, 03:15 AM Test Summary: 54391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5774

  18. Nicole Hummel uploaded patch set 7 12/15/16, 08:43

  19. TYPO3com voted on patch set 7 V +1 12/15/16, 08:48 Completed build in 04m 51s on Thu, 15 Dec, 09:48 AM Test Summary: 54391 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-5777

  20. Tymoteusz Motylewski voted on patch set 7 CR +1 V +1 12/15/16, 09:15

  21. Markus Klein commented on patch set 7 CR +1 12/15/16, 09:41

    Thanks for explanation
  22. Stefan Rotsch voted on patch set 7 CR +1 V +1 12/15/16, 09:50

  23. Markus Klein voted on patch set 7 V +1 12/15/16, 12:25

  24. Markus Klein voted on patch set 7 CR +2 V +2 12/15/16, 23:11

  25. Gerrit merged patch set 7 12/15/16, 23:11