Closed pollopolea closed 6 years ago
It is possible that you have old locks in the database.
Please put the server in maintenance mode and truncate the oc_file_locks table then try again. Your configuration looks ok.
After using the server there should be no new locks in the table.
As I said before, I stop web server, and truncate tables and after that i started sever again. Anyway, I just have done this steps again: 1) maintenance:mode --on 2) systemctl stop httpd24-httpd.service 3) truncate tables 4) systemctl start httpd24-httpd.service 5) maintenance:mode --off
And again there are new rows in the table "oc_file_locks"
Http server => stop sql tables (oc_file_locks)=> empty redis server (KEYS *) => empty
owncloud config.php
'filelocking.enabled' => true,
'filelocking.ttl' => 3600,
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '172.18.224.141',
'port' => 6379,
'timeout' => 0,
'password' => **** OMMITED ****,
),
Http server => running
sql tables (oc_file_locks)=> "id" "lock" "key" "ttl" 1285611 0 "files/b8babf424dc040e0028aef732c1a77b4" 1520239647 1285612 0 "files/5dcb9a052b69b48cfc03b6332df7d816" 1520239616 1285613 0 "files/04b5321444b4cc0a83e5f60354713419" 1520239616 1285614 0 "files/4d563c589303cd69713c443ba2dcf0ff" 1520239647 1285615 0 "files/6320d6eeca4a026ed9c9aad0192b8450" 1520239647
redis server (KEYS *) => empty
I stopped redis server while 1 client was syncronicing. This is the error
{"reqId":"Wpzvp50Sum@VFcHr9oW1EQAAAAE"
,"level":3
,"time":"2018-03-05T08:20:13+01:00"
,"remoteAddr": ****OMMITED***
,"user":"--"
,"app":"index"
,"method":"GET"
,"url":"\/"
,"message":"Exception: {\"Exception\":\"RedisException\"
,\"Message\":\"Redis server went away\"
,\"Code\":0
,\"Trace\":\"#0 /var/www/html/owncloud-10.0.6/lib/private/RedisFactory.php(85): Redis->auth('****OMMITED***')
#1 /var/www/html/owncloud-10.0.6/lib/private/RedisFactory.php(103): OC\RedisFactory->create()
#2 /var/www/html/owncloud-10.0.6/lib/private/Memcache/Redis.php(37): OC\RedisFactory->getInstance()
#3 /var/www/html/owncloud-10.0.6/lib/private/Memcache/Factory.php(132): OC\Memcache\Redis->__construct('dd9aabde8856943...')
#4 /var/www/html/owncloud-10.0.6/lib/private/Server.php(684): OC\Memcache\Factory->createLocking('lock')
#5 /var/www/html/owncloud-10.0.6/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#6 /var/www/html/owncloud-10.0.6/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('LockingProvider')
#7 /var/www/html/owncloud-10.0.6/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('LockingProvider')
#8 /var/www/html/owncloud-10.0.6/lib/private/Server.php(1433): OC\ServerContainer->query('LockingProvider')
#9 /var/www/html/owncloud-10.0.6/lib/private/Files/View.php(118): OC\Server->getLockingProvider()
#10 /var/www/html/owncloud-10.0.6/lib/private/Server.php(163): OC\Files\View->__construct()
#11 /var/www/html/owncloud-10.0.6/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC\{closure}(Object(OC\Server))
#12 /var/www/html/owncloud-10.0.6/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('EncryptionManag...')
#13 /var/www/html/owncloud-10.0.6/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('EncryptionManag...')
#14 /var/www/html/owncloud-10.0.6/lib/private/Server.php(868): OC\ServerContainer->query('EncryptionManag...')
#15 /var/www/html/owncloud-10.0.6/lib/base.php(753): OC\Server->getEncryptionManager()
#16 /var/www/html/owncloud-10.0.6/lib/base.php(671): OC::registerEncryptionWrapper()
#17 /var/www/html/owncloud-10.0.6/lib/base.php(998): OC::init()
#18 /var/www/html/owncloud-10.0.6/index.php(54): require_once('/var/www/html/o...')
#19 {main}\"
,\"File\":\"/var/www/html/owncloud-10.0.6/lib/private/RedisFactory.php\"
,\"Line\":85}"}
So I understand redis server is being used to lock ("OC\Memcache\Factory->createLocking('lock')").
I truncate again tables sqltable and I started redis server again. Desktop client started syncronized again. " searching for changes"
redis server (KEYS *) => empty sql tables (oc_file_locks)=> => 89 locks
One time (and only one), there were locks in redis AND locks in the sql tables. But I'm unable to reproduce this case again.
I did a local test with 10.0.7 and redis 4.0.8 with PHP 7.1.14.
In my config I simply added 'memcache.locking' => '\\OC\\Memcache\\Redis',
without config details.
Syncing with the desktop client does not produce any entries in my oc_file_locks table.
In redis I can see keys appearing and disappearing during the sync process by repeatedly running keys *
during the syncing process.
Not sure what the problem is on your side. At least the current implementation seems to be working here.
Note that in oc_file_locks the lock entries are kept even when not locked, this is an optimization to avoid too many deletions/insertions in the locks table. The lock entries are reused. However with redis as soon as the lock is released the entry/key is removed, which might explain why you did not see any.
Maybe I am wrong, but I'm starting to think that owncloud is using DB table to lock something , and Redis to lock uploaded files.
Test 1:
redis server (KEYS *) => empty
Test 2: Close client, Open client.
Test 3: Close client, Open client. Force syncronization
Test 4: Running client, create 15 folder.
Test 5: Running client, create 15 folder, whith 2 files insides (1.8GB).
new locks in oc_:file_locks
sql tables (oc_file_locks)=> 30 file locks (15 previously)
new locks in redis
redis server (KEYS *) =>
1) "dd9aabde88569436159a1f634299fb1d/lockfiles/e5acb51a796d22254c5051ecc61550ae"
2) "dd9aabde88569436159a1f634299fb1d/lockfiles/a6260d161013233ea5c24bbcded63bdd"
3) "dd9aabde88569436159a1f634299fb1d/lockfiles/66c31417cb79c44f6a75bdb6233263df"
4) "dd9aabde88569436159a1f634299fb1d/lockfiles/5b6310dd9ae7cd8cf87383f72fa62fd9"
5) "dd9aabde88569436159a1f634299fb1d/lockfiles/0372627b708401fe61bdee33f039f6e2"
Test 7: (Cron disabled). No new operation with files or folder. Some minutes later:
Test 8: 500 small file (< 1MB), totalzise 378MB While uploading:
(Cron disabled). No new operation with foles or folder. 1h later:
| TTL | n | GMT
| ----------- |-- | -----
| 1520263123 | 5 | 15:18
| 1520264342 |10 | 15:39
| 1520264341 | 2 | 15:39
Conclusion:
My question: ¿Why are there locks in the sq ltables? From my point of view , this is some kind of bug.
I suppose I can close this bugs, and maybe open another about filelocks in sql tables while using redis.
I've renamed this ticket, let's reuse it for the problem you observe.
When memcache (redis) is configured for locking, this is the code that decides whether to use DB or Memcache (Redis): https://github.com/owncloud/core/blob/v10.0.7/lib/private/Server.php#L685
and here the MemcacheFactory would set the $lockingCacheClass
to the value set in config.php: https://github.com/owncloud/core/blob/v10.0.7/lib/private/Memcache/Factory.php#L115
The only way that would make it fall back to the database would be if somehow the config or class availability is instable.
Are you using a clustered environment with multiple nodes ?
In this case, I created a test environment with one web server node and another node running only redis. The only web server node is working as single-instance more (default mode in config.php)
@pollopolea can you try running occ config:system:get memcache.locking
and let us know the output please
Hi, tomneedham this is the output:
$occ config:system:get memcache.locking
\OC\Memcache\Redis
Hi again, how can I get the path of files in the lock table? I tried some sql sentences without success:
SQL table:
id | lock | key | ttl
1502881 0 files/3872e0c32f4ab290b71be8c3256f832f 1521105952
REDIS:
3736505ae3f7ce31dff8eff686eb0f71/lockfiles/b600b18dc28d6c1e1af7a439254427b5
select * from oc_filecache where path_hash = '3872e0c32f4ab290b71be8c3256f832f';
select * from oc_filecache where checksum like '%3872e0c32f4ab290b71be8c3256f832f%'; -
After installing new server using sqlite, mysql and oci, y finally detect the problem. Redis and owncloud are working fine. The problem was my configuration, although the owncloud node was configured to use a different DB (in a different server, with different ip), in fact that DB is the same that is being used with other 2 nodes without redis.
The result is that the source of the locks are nodes without redis.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.