Review main Merged

39895[BUGFIX] Avoid race conditions in typo3temp/Cache

Bernhard Kraft CR +2 V +2 Easy +4 −2 updated 06/25/15, 18:14

Commit message

Race conditions can occur when the cache in typo3temp/Cache gets
cleared, for example by using the Install Tool "Clear all caches"
button. The cache is currently cleared using GeneralUtility::rmdir()
which does a directory traversal and unlinks all contained files.
Instead GeneralUtility::flushDirectory() should get used. This method
renames the directory into a temp-dir name and then removes the temp-dir
using GeneralUtility:rmdir().

Review

  • Code review CR +2
    • Andreas Kienast +2
    • Alexander Opitz +1
    • Anja Leichsenring +1
  • Verified V +2
    • Andreas Kienast +2
    • Alexander Opitz +1
    • Anja Leichsenring +1

Issues 1

Files 2

Review log 25

  1. Bernhard Kraft uploaded patch set 1 06/02/15, 13:20

  2. Markus Klein commented on patch set 1 CR -1 06/02/15, 16:33

    do not add more functions to GenUtil!
  3. Bernhard Kraft commented on patch set 1 06/03/15, 07:36

    1. I and some others already tried to move some methods (not regarding this issue) OUT OF GeneralUtility. Nobody cared and the issue starts rotting: https://review.typo3.org/#/c/31242/ 2. The "flushDirectory" method also just got added recently (2012) by Oliver Hader. I do not want to sound nitpicking but is it only the privilege of some special people to add new methods to t3lib_div? (Have a look at commit 9306751c32bd73d61bc11d8c5f494438465cf09e)
  4. Bernhard Kraft commented on patch set 1 06/03/15, 07:40

    If it is about the "register_shutdown_function": I am aware there is no TYPO3 class for it but I am against going the way to reimplement the OS (or template language) itself in TYPO3. For me also FAL is a thing I would never have agreed with. If I need to mount some remote storage I would do it on the OS side. But we are all obliged to have different positions ...
  5. Markus Klein commented on patch set 1 06/03/15, 07:47

    Bernhard, 1.) The mentioned issue is not stalled because of moving methods out of GenUtil, but because there is a disagreement about the new solution 2.) You know that this is not true. And, sorry, but 2012 is not recently by any means. In the current CMS pace I consider 2 months as recently, anything else is basically old. ;-) Please join us on the Slack channel #typo3-cms-coredev and discuss your issue/solution there. Thanks.
  6. Bernhard Kraft commented on patch set 1 06/03/15, 08:03

    *uff* this slack seems complicated. I had to go through 10 forms just for registering ... I guess I'll stay on IRC.
  7. Mathias Schreiber commented on patch set 1 06/25/15, 14:52

    here, I even did all the typing for you (3 formfields btw). All you need to do is click a link in the email and set a password (choose 12345 if you want to keep it less complicated) ;-)
  8. Markus Klein commented on patch set 1 06/25/15, 15:15

    GeneralUtility.php:2834

    What is the benefit here? We already renamed the top-most directory, which is a quick operation already. Concurrent requests should not be affected anymore.

    ClearCacheService.php:48

    I agree on using flushDirectory here!
  9. Alexander Opitz commented on patch set 1 06/25/15, 15:16

    ClearCacheService.php:48 Reply

    After flushing we should clear OpcodeCache on that directory.
  10. Markus Klein uploaded patch set 2 06/25/15, 15:20

  11. Alexander Opitz commented on patch set 2 06/25/15, 15:22

    ClearCacheService.php:50

    As written on Slack, it needs to be done after renaming but before removing the files to close the gap between renaming and after deleting.
  12. Markus Klein uploaded patch set 3 06/25/15, 15:23

  13. Markus Klein uploaded patch set 4 06/25/15, 15:24

  14. Alexander Opitz voted on patch set 4 V +1 CR +1 06/25/15, 15:26

  15. Andreas Kienast voted on patch set 4 CR +1 06/25/15, 15:28

  16. Markus Klein uploaded patch set 5 06/25/15, 15:30

  17. Andreas Kienast voted on patch set 5 CR +1 V +1 06/25/15, 15:31

  18. Anja Leichsenring voted on patch set 5 CR +1 V +1 06/25/15, 15:32

  19. Alexander Opitz updated the commit message in patch set 6 06/25/15, 15:33

  20. Alexander Opitz voted on patch set 6 V +1 CR +1 06/25/15, 15:33

  21. Andreas Kienast voted on patch set 6 CR +1 V +1 06/25/15, 15:33

  22. Anja Leichsenring voted on patch set 6 CR +1 V +1 06/25/15, 15:34

  23. Andreas Kienast voted on patch set 6 CR +2 V +2 06/25/15, 15:37

  24. Andreas Kienast merged patch set 6 06/25/15, 15:37

  25. Helmut Hummel commented on patch set 7 06/25/15, 18:14

    Post -1 on the particular issue I commented …

    GeneralUtility.php:2816

    that third parameter does not make any sense at all. The method is about removing a directory, which has nothing to do with opcode caches …