Oc_file_lock: understanding values lock field

Hello Community,

please can anybody help me to understand entries in the table oc_file_lock?

  • I can imagine the meaning of lock=0 and lock=1 :wink:
  • But what is lock=-1 about?
  • And why are there values greater than 1?

The Background of my interest ist the following:

I did
occ files:scan --path=username
and i got this error output:

Exception during scan: "files/179bbe3c88cc0387325fe2bd86e1372a" is locked
#0 /var/www/nextcloud/lib/private/Files/Storage/Common.php(752): OC\Lock\DBLockingProvider->acquireLock()
#1 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(594): OC\Files\Storage\Common->acquireLock()
#2 /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(594): OC\Files\Storage\Wrapper\Wrapper->acquireLock()
#3 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(147): OC\Files\Storage\Wrapper\Wrapper->acquireLock()
#4 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(423): OC\Files\Cache\Scanner->scanFile()
#5 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(388): OC\Files\Cache\Scanner->handleChildren()
#6 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(391): OC\Files\Cache\Scanner->scanChildren()
#8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(340): OC\Files\Cache\Scanner->scanChildren()
#9 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(260): OC\Files\Cache\Scanner->scan()
#10 /var/www/nextcloud/apps/files/lib/Command/Scan.php(151): OC\Files\Utils\Scanner->scan()
#11 /var/www/nextcloud/apps/files/lib/Command/Scan.php(207): OCA\Files\Command\Scan->scanFiles()
#12 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute()
#13 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
#14 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1012): OC\Core\Command\Base->run()
#15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand()
#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun()
#17 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#18 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#19 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#20 {main}
| Folders | Files | Elapsed time |
| 1687    | 17232 | 00:01:38     |

So i deleted with phpmyadmin all these entries:

DELETE FROM `nextcloud`.`oc_file_locks` WHERE `oc_file_locks`.`lock` > 0;

But the error persists.
So i searched the oc_file_locks for the locked file 179bbe3c88cc0387325fe2bd86e1372a and found lock=-1

  • There are more rows with lock=-1 in my database
  • Is this a problem?

Thank you all for being interested in my Problem :pray:
This is my first post :blush:

Greetz, Flo

1 Like

Is this really a dev question or a support question? :see_no_evil:

Oh no! This is of course not a dev question. I moved it into support.
My fault - sorry! Thanx for reading and pushing me back on track!
(my fist post and what a mess :woozy_face:)

1 Like

I had exact the same problem today and now the same question… what is the -1?

Yes Zappa, strange thing. Good to know that i am not alone :wink:
Deleting all Values not equal 0 is working

DELETE FROM `nextcloud`.`oc_file_locks` WHERE `oc_file_locks`.`lock` != 0;

but… what is the -1?

btw what i didnt mention yet: i run on 10.1.45-MariaDB-0+deb9u1 - Debian 9.12
so obviously that cause is neigher limited to MariaDB or Postgres

1 Like

Now we are 2… and i am on your side - its probably a “dev question”…:wink:

Before i move this topic back to dev, i’ll leave it here for some days waiting for more answers.

Here again the two questions for quick readers: :nerd_face:

  • In oc_file_locks.lock:

    • What is the meaning of value -1?
    • What is the meaning of values >1?

You’re not actually developing. You’re trying to resolve a problem with your instance. This is support/troubleshooting.

We are not trying to resolve any problem. We are only trying to understand, what the values mean.
Instead of moaning, would be nice to help us.

1 Like