Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

files:scan shows 'Exception during scan: "..." is locked, existing lock on file: exclusive'. #1031

Closed
hwiorn opened this issue May 30, 2019 · 9 comments

Comments

@hwiorn
Copy link

hwiorn commented May 30, 2019

  • 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     |
+---------+-------+--------------+
~ # 
@kyrofa
Copy link
Member

kyrofa commented May 30, 2019

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/ .

@hwiorn
Copy link
Author

hwiorn commented May 30, 2019

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?

@bernermic
Copy link

bernermic commented Jul 16, 2019

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     |
+---------+-------+--------------+

@EdwardEisenhauer
Copy link

I have the same problem

@sebastiaanmilis
Copy link

sebastiaanmilis commented Nov 26, 2020

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

@kyrofa
Copy link
Member

kyrofa commented Jan 21, 2021

This is what you want, no need to install redis-cli outside of the snap:

$ sudo snap run --shell nextcloud.redis-server -c '$SNAP/bin/redis-cli -s /tmp/sockets/redis.sock flushall'

This is really a workaround for what appears to be an upstream Nextcloud bug. We use redis as recommended, I suggest logging an issue upstream. I'm going to go ahead and close this here.

@kyrofa kyrofa closed this as completed Jan 21, 2021
@marvinjuette
Copy link

I just got a pretty similar error message. I used default file locking mechanisms (database entries).
My database had some really confusing values in the lock column (eg. 3,5 or even 16).
So I removed every row that presumably locked those files in the database using

DELETE FROM oc_file_locks WHERE oc_file_locks.lock != 0

Everything works properly afterwards.
But I am not sure what caused it. I just made the upgrade from 21.0.0 to 21.0.3. But I experienced some problems with my notebook along the way, so maybe the client of notebook caused it.

@dev-brothers-bg
Copy link

what helped me was disabling file locking temporary and running file scan again:
config/config.php>>
'filelocking.enabled' => false,

@Jazz7584
Copy link

Jazz7584 commented Jun 3, 2024

what helped me was disabling file locking temporary and running file scan again: config/config.php>> 'filelocking.enabled' => false,

For me this worked too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants