Review main Abandoned

50089[WIP][BUGFIX] Ignore invalid cache backends for CLI

Georg Ringer CR 0 V 0 Normal +32 −19 updated 02/13/20, 12:41

Commit message

Apc and ApcU should be ignored for CLI. An additional options
flags those backends.

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 4

Review log 1821

  1. Georg Ringer uploaded patch set 1 10/04/16, 17:16

  2. TYPO3com voted on patch set 1 V -1 10/04/16, 17:19 Completed build in 03m 07s on Tue, 4 Oct, 07:19 PM Test Summary: 18535 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-3321

  3. Benni Mack commented on patch set 1 10/06/16, 19:33

    Can you elaborate why APC/APCU is not working in CLI? There is an option to activate it for cli.
  4. Georg Ringer commented on patch set 1 10/07/16, 07:59

    yes it can be enabled for CLI but if it is disabled it will be still used there and set by the Install Tool preset
  5. Josef Glatz commented on patch set 1 10/30/16, 05:18

    @Benni, I found at least 2 hosting companies where I couldn't activate it.
  6. Christian Kuhn commented on patch set 1 CR -1 10/30/16, 11:12

    i see the need for a patch like this. apc and apcu are a hassle on cli if enabled, and also if disabled. additionally, claus had the request to fall back to a "null backend" if a getCache() on a non registered cache name is fetched (will ask why exactly he needs that). but that brings me to the idea that we maybe just keep the patch very similar to what is proposed, but instead of falling back to db backend (i commented a problem with that inline), we may just fall back to null backend or maybe the runtime backend?

    CacheManager.php:248

    The problem with falling back to the "databaseBackend" in CLI is that the db backend needs db tables. So, If we are in non-cli, the installer would say "no db tables needed" while the system would happily crash on cli because of missing tables.
  7. Christian Kuhn commented on patch set 1 10/30/16, 11:14

    I also thought about an "CliCapable" interface for backends, but that doesn't work since it depends on apc configuration if the backend works on cli or not ... doesn't look like a good solution with the interface and we're probably better off with the 'option' that is proposed.
  8. Claus Due commented on patch set 1 10/31/16, 14:08

    CacheManager.php:247

    I have a small suggestion for this: rather than setting "skipForCli" couldn't we make a cache backend option where you can list the PHP_SAPI values that the cache is *enabled* in, which if empty, enables all of them? Alternatively, might we consider making it possible to create different configurations based on FE/BE/CLI (using merging, where there is a standard config and optional+partial config for each context). I can see this making sense in a broader perspective where you want your CLI to use for example transient memory and only the FE to use memcached. Either one could (also) solve this current use case to skip in CLI. I think I like the second one better due to the greater control.
  9. Oliver Klee commented on patch set 1 11/02/16, 10:25

    ApcPreset.php:43

    Can we please name it "use in CLI" (useInCli)? I find boolean flags that work like "say yes to not use it, say no to use it" confusing to read (i.e., easy to get wrong when reading/using).
  10. Christian Kuhn commented on patch set 1 11/02/16, 11:58

    hmmm, claus, the second idea "configure backends depending on context" could maybe be done with a "DelegateBackend" that hands over actions to the "real" backend configured ... sounds a bit fishy, though ... also, i'm not entirely sure if we should follow that path at all. we have enough context / scoping issues already and giving admins a chance to have different backends depending on SAPI may be counterproductive and adds even more complexity. i like the "option list for SAPI's" idea better. This gives us a sane default and flexibility. Claus, would you like to change the patch in this way: have a list of sapis with the "all" fallback and additionally fall back to "transient" backend if a specific cache is configured to be disabled on given SAPI?
  11. Benni Mack commented on patch set 1 12/19/16, 20:51

    OK. Nicolas Grekas from Blackfire / Symfony had a great idea btw... he built a new CacheBackend which is basically a two-level cache - first level is APC (if available) - second level is file-based if APC is not available, it directly flushes the file-based. It is also cool for cloud environments, as you could ship a system with a pre-warmed file-system cache (on a read-only FS) but the APC kicks in to do stuff faster. Does not exactly solve your problem, but I really liked the concept.
  12. Thomas Maroschik commented on patch set 1 03/13/17, 08:47

    In general, it's a problem that the SAPIs can have different configurations. I have recently build an importer that used the DataHandler and couldn't clear the Frontend Caches as those were set up to use APCu. It was deactivated in CLI. It would be nice when there were something like a purge queue.This one must be accessible by all entrypoints and the individual cache providers should work on the queue before fetching their cache items. Maybe we come up with a scheduler task that then takes care of purging.
  13. Josef Glatz updated the commit message in patch set 2 03/30/18, 07:44

  14. TYPO3com voted on patch set 2 V -1 03/30/18, 07:44 Completed build in 07s on Fri, 30 Mar, 09:44 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-21877

  15. Josef Glatz commented on patch set 2 CR -1 03/30/18, 07:44

    Still needs to be discussed (just updated 7.6 to 8,7)
  16. Thomas Maroschik wrote 04/15/18, 17:00

    Removed reviewer Thomas Maroschik.
  17. Benni Mack commented on patch set 2 10/26/18, 11:50

    OK. So using APCu is broken on various levels: - When using CLI in conjunction with APC, it will never be possible to "cleanly" access (or flush) the APCu cache for a web request. - With APC, it can be made possible in shared hosting env to access other users' APC cache (=> uncool) - In examples of using extbase_object cache, and people do a deployment, then the code is changed, and it is NEVER possible to invalidate cache - apcu has no proper FILO concept, and has issues with overflows So, in my opinion, APCu should _only_ be used if people either "hack their way" around issues on deployment, or don't do deployments or don't do multi-server setups or don't do CLI functionality.
  18. Benni Mack updated the commit message in patch set 3 12/14/18, 09:59

  19. TYPO3com voted on patch set 3 V -1 12/14/18, 10:03 Completed build in 01m 05s on Fri, 14 Dec, 11:03 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-30693

  20. Benni Mack commented on patch set 3 02/13/20, 11:02

    I recommend to abandon this change and actually documenting the issue (maybe in the preset!) to use https://github.com/gordalina/cachetool when used in CLI conjunction. Also see https://medium.com/@davidtstrauss/avoiding-the-pitfalls-of-apcu-4aa9de00ef93
  21. Georg Ringer abandoned the change 02/13/20, 12:41