Review main Abandoned

61897[BUGFIX] Disable cache on errors in content objects

Christoph Lehmann CR 0 V 0 Easy +6 −0 updated 02/27/20, 12:53

Commit message

Errors in content objects may occur due to temporary service outages
and should never be cached like in the other exception handlers.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 2

Review log 2026

Show 1 earlier messages
  1. Christoph Lehmann uploaded patch set 1 10/06/19, 14:23

  1. TYPO3com voted on patch set 1 V -1 10/06/19, 14:34 Completed build in 10m 27s on Sun, 6 Oct, 02:34 PM Test Summary: 47758 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37064

  2. TYPO3com commented on patch set 1 10/06/19, 17:36 Completed build in 10m 20s on Sun, 6 Oct, 05:36 PM Test Summary: 47758 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37065

  3. TYPO3com voted on patch set 1 V +1 10/06/19, 20:06 Completed build in 2h 50m 17s on Sun, 6 Oct, 08:06 PM Test Summary: 47759 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37065

  4. Tobi Kretschmann commented on patch set 1 10/08/19, 08:11

    ContentObjectRenderer.php:830

    You could simply set $cacheConfiguration = null;
  5. Christoph Lehmann commented on patch set 1 10/08/19, 09:45

    > Patch Set 1: > > (1 comment) As discussed: There is no cacheConfiguration in my example and the no_cache=true is needed to prevent that the page is going into cache.

    ContentObjectRenderer.php:830 Reply

    As discussed: There is no cacheConfiguration in my example and the no_cache=true is needed to prevent that the page is going into cache.
  6. Tobi Kretschmann voted on patch set 1 CR +1 10/08/19, 10:12

  7. Kai Möller voted on patch set 1 CR +1 10/08/19, 10:36

  8. Julian Geils voted on patch set 1 CR +1 10/08/19, 14:13

  9. Sascha Rademacher voted on patch set 1 CR +1 10/09/19, 08:51

  10. Henning Liebe commented on patch set 1 10/09/19, 11:08

    ContentObjectRenderer.php:830 Reply

    IMO there is no need to add a new return here. If you just set $cacheConfiguration = null; you could skip that return.
  11. Christoph Lehmann commented on patch set 1 10/09/19, 12:06

    ContentObjectRenderer.php:830 Reply Unresolved

    IMO the early return makes the code faster and better readable. It works and no unnecessary code is executed. In Line 810 there is another early return. Given you want to remove it you somehow have to use an else block which increases the cognitive complexity.
  12. Jörg Bösche commented on patch set 1 CR +1 10/11/19, 08:12

    I also do not like the early return in this case, but there is no performance issue or something else with your implementation. To get ahead, I'll give you +1.
  13. Felix P. voted on patch set 1 CR +1 10/11/19, 09:08

  14. Benni Mack uploaded patch set 2 11/04/19, 15:28

  15. TYPO3com voted on patch set 2 V -1 11/04/19, 15:41 Completed build in 12m 40s on Mon, 4 Nov, 03:41 PM Test Summary: 21 of 48438 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37983

  16. Benni Mack uploaded patch set 3 11/07/19, 21:41

  17. TYPO3com commented on patch set 2 11/07/19, 21:43 Completed build in 6h 26m 39s on Thu, 7 Nov, 09:43 PM Test Summary: 21 of 48438 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-37983

  18. TYPO3com voted on patch set 3 V -1 11/07/19, 21:54 Completed build in 10m 37s on Thu, 7 Nov, 09:54 PM Test Summary: 241 of 47683 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-38088

  19. Susi Moog commented on patch set 3 CR -1 11/09/19, 16:43

    I'd rather see people needing this to implement their own exception handler, as the errors in content objects are explicitly handeld in a way that has as little impact as possible - disabling cache because _one_ element has an error seems like overkill to me. Additionally, if you want that behaviour the other option would be to disable the content exception handling and fall back to the main exception handler, which takes care of the full page handling incl. no caching. Imagine a little content element on a high traffic site having said temporary service outage - resulting after this change in a potential denial of service.
  20. Christoph Lehmann commented on patch set 3 11/09/19, 17:41

    > Patch Set 3: Code-Review-1 > > I'd rather see people needing this to implement their own exception handler, as the errors in content objects are explicitly handeld in a way that has as little impact as possible - disabling cache because _one_ element has an error seems like overkill to me. Additionally, if you want that behaviour the other option would be to disable the content exception handling and fall back to the main exception handler, which takes care of the full page handling incl. no caching. > > Imagine a little content element on a high traffic site having said temporary service outage - resulting after this change in a potential denial of service. Please see this patch like having "stronger defaults", means, "no error should go into cache". What plugin developers then do with exceptions is up to them. The content exception handler is a big improvement for TYPO3 since the rest of a faulty page is still visible. For that reason would never disable it. Sure, the server load increases when it's a high traffic site, but again, that's up to the developer. New sidetopic: IMO we should always return a 500 in case of error handling through the content exception handler since faulty pages should not get into search engine index. What do you think?
  21. Benni Mack commented on patch set 3 01/22/20, 15:18

    Hey, > The content exception handler is a big improvement for TYPO3 since the rest of a faulty page is still visible. For that reason would never disable it. > Sure, the server load increases when it's a high traffic site, but again, that's up to the developer. > New sidetopic: IMO we should always return a 500 in case of error handling through the content exception handler since faulty pages should not get into search engine index. What do you think? Both of the topics revolve around the information that TYPO3 should not consider any of these parts as "cacheble" or "success". But this is highly dependent on the context. How would a developer know if a status code showed up? We're lacking lots of proper configuration to inform the developer that there is an issue. I give you an example: Somehow a developer added a plugin "World Clock" into each page on the right sidebar. Now, the rest of the page shows up, gets cached etc. and still works fine. But the World Clock plugin is only compat with e.g. PHP 7.2.4 or lower but not with PHP 7.2.5+, and the hoster just updated the PHP version - this would make _all_ the pages (which show proper content for the rest) as an error PLUS open up the risk for DoS due to not caching at all. However, the developer is out-of-office / on vacation but put this thing in TypoScript, so the editor cannot remove it - would you consider caching this and sending out 200-response? I would. But of course, having a faulty EXT:news because a newly added news, should result in a 500 on the detail page because of a manually removed image. Stuff like that makes it hard to find the right path here. Both options are valid, but the current status does not open the door for DoS, which is the main benefit for me in terms of "strong default".
  22. Christoph Lehmann commented on patch set 3 01/22/20, 18:07

    Hey, the given examples are both comprehensible. You are right, there is a lack of options for the developer how to handle such errors (partially cache the generated page, set lower cache times, return 500/503, etc.). So maybe we should think in this direction.
  23. Benni Mack commented on patch set 3 01/27/20, 11:04

    > Patch Set 3: > > Hey, > > the given examples are both comprehensible. You are right, there is a lack of options for the developer how to handle such errors (partially cache the generated page, set lower cache times, return 500/503, etc.). So maybe we should think in this direction. Let's proceed with the discussion in the issue then, and come up with a proper solution where devs have the possibility to configure this properly. OK with you?
  24. Benni Mack commented on patch set 3 01/27/20, 11:08

    Hmm, one way could be to tell TYPO3 that there are errors and send other HTTP headers, but we could still keep the result in page cache?
  25. Benni Mack abandoned the change 02/27/20, 12:53

    discussion followup on the issue directlythen