Nextcloud-snap: files:scan shows 'Exception during scan: "..." is locked, existing lock on file: exclusive'.

Created on 30 May 2019  路  5Comments  路  Source: nextcloud/nextcloud-snap

  • Nextcloud-snap version: nextcloud-15.0.8snap2 (rev 13453)

I copied my usb backup storage(~1.5TB) to nextcloud earlier yesterday and files:scan showed 'file is locked' after a long while. I already check oc_file_locks table but there is no locked files.

~~~
mysql> select * from oc_file_locks;
Empty set (0.00 sec)

mysql>
~~~

I don't know which file is locked. How can i debug it?

~~~
~# nextcloud.occ files:scan ed
Starting scan for user 1 out of 1 (ed)
Exception during scan: "files/e1e43e5db8822170262fffc03cef32a9" is locked, existing lock on file: exclusive

0 /snap/nextcloud/13453/htdocs/lib/private/Files/Storage/Common.php(714): OC\Lock\MemcacheLockingProvider->acquireLock('files/e1e43e5db...', 2)

1 /snap/nextcloud/13453/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php(593): OC\Files\Storage\Common->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))

2 /snap/nextcloud/13453/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php(593): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))

3 /snap/nextcloud/13453/htdocs/lib/private/Files/Cache/Scanner.php(331): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\MemcacheLockingProvider))

4 /snap/nextcloud/13453/htdocs/lib/private/Files/Utils/Scanner.php(245): OC\Files\Cache\Scanner->scan('', true, 3)

5 /snap/nextcloud/13453/htdocs/apps/files/lib/Command/Scan.php(145): OC\Files\Utils\Scanner->scan('/ed', true, NULL)

6 /snap/nextcloud/13453/htdocs/apps/files/lib/Command/Scan.php(201): OCA\Files\Command\Scan->scanFiles('ed', '/ed', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)

7 /snap/nextcloud/13453/htdocs/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

8 /snap/nextcloud/13453/htdocs/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

9 /snap/nextcloud/13453/htdocs/3rdparty/symfony/console/Application.php(946): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

10 /snap/nextcloud/13453/htdocs/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

11 /snap/nextcloud/13453/htdocs/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

12 /snap/nextcloud/13453/htdocs/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

13 /snap/nextcloud/13453/htdocs/console.php(96): OC\Console\Application->run()

14 /snap/nextcloud/13453/htdocs/occ(11): require_once('/snap/nextcloud...')

15 {main}

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 0 | 0 | 00:00:00 |
+---------+-------+--------------+
~ #
~~~

Most helpful comment

I found radis-cli flushall tricks in Forum.

~
sudo redis-cli -s /var/run/redis/redis.sock flushall
~

But, nextcloud-snap does not export redis.sock to outside.
Can i access this redis socket?

All 5 comments

I'm afraid I'm not sure. The snap uses redis for locks, but I've never seen an error like that before-- it doesn't seem snap-specific. I suggest asking over at https://help.nextcloud.com/ .

I found radis-cli flushall tricks in Forum.

~
sudo redis-cli -s /var/run/redis/redis.sock flushall
~

But, nextcloud-snap does not export redis.sock to outside.
Can i access this redis socket?

Hey, I face the same issue, but I did not modify or move my attached storage at all. One user simply has the issue that a file is locked (same message as @hwiorn).
Checking the oc_file_locks table shows 0 entries.
My setup is a RaspberryPi 3+ with an Ubuntu core 18 and Nextcloud 15.0.10. Harddrive is an 1TB spinning disk.
The file in question is within a group-folder located - so maybe this is a special case ...

So far only one user is affected by this and I still need to investigate further.

@hwiorn any further progress for you yet?

Groupfolder scan shows no issue

$ sudo nextcloud.occ groupfolders:scan 5
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 219     | 794   | 00:00:16     |
+---------+-------+--------------+

and files scan too:

$ sudo nextcloud.occ files:scan --all
Starting scan for user 1 out of 15 
 ...
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 6114    | 34241 | 00:04:55     |
+---------+-------+--------------+

I have the same problem

You can access the socket via /tmp/snap.nextcloud/tmp/sockets/redis.sock so the following command should do the trick:
sudo redis-cli -s /tmp/snap.nextcloud/tmp/sockets/redis.sock flushall

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RadZaeem picture RadZaeem  路  8Comments

aptanet picture aptanet  路  7Comments

DAMONSTA360 picture DAMONSTA360  路  3Comments

dutchievj picture dutchievj  路  4Comments

kyrofa picture kyrofa  路  6Comments