Open joshtrichards opened 8 months ago
This answers part of it:
Basically, every time PHP get's restarted, APCu is cleared, so are the locks. This is not the case with Redis by default.
Adding a check that explicitly disallows APCu for memcache.locking even if specified explicitly in the config?
I would say push a warning basically with the same message than above 👍
Is APCu acceptable for usage for transactional file locking under any circumstances we consider "supported"? If it's acceptable, are there caveats?
Background: Last year @linuxserver set a default value of for
memcache.locking
that utilizes APCu in their Nextcloud image: https://github.com/linuxserver/docker-nextcloud/commit/aaa5539e72f9539724962f62eb5b355aee53d90e via linuxserver/docker-nextcloud#317.This was apparently in response to the performance warning added in v27 (when the database is being used for locking - i.e. when Redis isn't configured): linuxserver/docker-nextcloud#319
The end result is that all LinuxServer image users are now using APCu for transactional file locking rather than the database (unless the admin has explicitly configured Redis). This achieved their goal: no longer a warning about using the database for locking.
But is this a valid configuration?
Our documentation is not 100% clear whether we support the use of APCu for
memcache.locking
:We have fallback code that appears to prefer a
NULL_CACHE
(over using APCu as a fallback) for locking: https://github.com/nextcloud/server/blob/f2f1074396b12be31f84a3db30f7e95c501c4aab/lib/private/Memcache/Factory.php#L101-L103My understanding is that APCu can maybe work for mod_php and some PHP-FPM operating modes. The key requirement being that the operating mode in-use must permit all processes to use a shared APCu cache. However, even if the application server layer is fine, anything happening at the command-line will not use the same APCu cache (effectively being blind to Transaction File Locking). This could lead to problems in areas like
occ files
commands (and possibly others) I'd think.So is APCu acceptable at all? Is it worse - or better - than a NULL_CACHE?
TODO:
memcache.locking
even if specified explicitly in the config?