Fatal WebDav error in log

Hello

thsi is what I saw when I logged in today. The user updated one of his contacts (added a second address). It worked, the contact got updated but it generated the error beneath.

Fatal - webdav - Exception: {"Message":"An exception occurred while executing 'INSERT INTOoc_file_locks(key,lock,ttl) SELECT ?,?,? FROMoc_file_locksWHEREkey` = ? HAVING COUNT(*) = 0’ with params
[“files\/33aac9d624f6d5fe4ffb840bb0303a2d”, 1, 1466678204,
“files\/33aac9d624f6d5fe4ffb840bb0303a2d”]:\n\nSQLSTATE[23000]:
Integrity constraint violation: 1062 Duplicate entry
’files/33aac9d624f6d5fe4ffb840bb0303a2d’ for key
’lock_key_index’",“Exception”:“Doctrine\DBAL\Exception\UniqueConstraintViolationException”,“Code”:0,“Trace”:"#0

/home/xxxxx/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(116):
Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException(‘An
exception oc…’, Object(Doctrine\DBAL\Driver\PDOException))\n#1
/home/xxxxx/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(996):

Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver),
Object(Doctrine\DBAL\Driver\PDOException), ‘INSERT INTO oc...', Array)\n#2 \/home\/xxxxx\/nextcloud\/lib\/private\/db\/connection.php(205): Doctrine\\DBAL\\Connection->executeUpdate('INSERT INTOoc…’,
Array, Array)\n#3
/home/xxxxx/nextcloud/lib/private/db/adapter.php(93):
OC\DB\Connection->executeUpdate(‘INSERT INTO `*P…’, Array)\n#4
/home/xxxxx/nextcloud/lib/private/db/connection.php(243):
OC\DB\Adapter->insertIfNotExist(‘PREFIXfile_lo…’, Array,
Array)\n#5
/home/xxxxx/nextcloud/lib/private/lock/dblockingprovider.php(113):
OC\DB\Connection->insertIfNotExist(‘PREFIXfile_lo…’, Array,
Array)\n#6
/home/xxxxx/nextcloud/lib/private/lock/dblockingprovider.php(158):
OC\Lock\DBLockingProvider->initLockField(‘files/33aac9d62…’,
1)\n#7
/home/xxxxx/nextcloud/lib/private/files/storage/common.php(663):
OC\Lock\DBLockingProvider->acquireLock(‘files/33aac9d62…’,
1)\n#8
/home/xxxxx/nextcloud/lib/private/files/storage/wrapper/wrapper.php(577):
OC\Files\Storage\Common->acquireLock(‘files/KeePass/c…’, 1,
Object(OC\Lock\DBLockingProvider))\n#9
/home/xxxxx/nextcloud/lib/private/files/storage/wrapper/wrapper.php(577):

OC\Files\Storage\Wrapper\Wrapper->acquireLock(‘files/KeePass/c…’,
1, Object(OC\Lock\DBLockingProvider))\n#10
/home/xxxxx/nextcloud/lib/private/files/storage/wrapper/wrapper.php(577):

OC\Files\Storage\Wrapper\Wrapper->acquireLock(‘files/KeePass/c…’,
1, Object(OC\Lock\DBLockingProvider))\n#11
/home/xxxxx/nextcloud/lib/private/files/view.php(1888):
OC\Files\Storage\Wrapper\Wrapper->acquireLock(‘files/KeePass/c…’,
1, Object(OC\Lock\DBLockingProvider))\n#12
/home/xxxxx/nextcloud/lib/private/files/view.php(1990):
OC\Files\View->lockPath(’/KeePass/cgai.k…’, 1, false)\n#13
/home/xxxxx/nextcloud/lib/private/files/view.php(1083):
OC\Files\View->lockFile(’/KeePass/cgai.k…’, 1)\n#14
/home/xxxxx/nextcloud/lib/private/files/view.php(943):
OC\Files\View->basicOperation(‘fopen’, ‘KeePass/cgai.kd…’,
Array, ‘rb’)\n#15
/home/xxxxx/nextcloud/apps/dav/lib/connector/sabre/file.php(304):
OC\Files\View->fopen(‘KeePass/cgai.kd…’, ‘rb’)\n#16
/home/xxxxx/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(83):
OCA\DAV\Connector\Sabre\File->get()\n#17 [internal function]:
Sabre\DAV\CorePlugin->httpGet(Object(Sabre\HTTP\Request),
Object(Sabre\HTTP\Response))\n#18
/home/xxxxx/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105):
call_user_func_array(Array, Array)\n#19
/home/xxxxx/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php(459):
Sabre\Event\EventEmitter->emit(‘method:GET’, Array)\n#20
/home/xxxxx/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php(248):
Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request),
Object(Sabre\HTTP\Response))\n#21
/home/xxxxx/nextcloud/apps/dav/appinfo/v1/webdav.php(55):
Sabre\DAV\Server->exec()\n#22
/home/xxxxx/nextcloud/remote.php(138):
require_once(’/home/xxxxx/…’)\n#23
{main}",“File”:"/home/xxxxx/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php",“Line”:66,“User”:“xxxx”}`

Do you have any idea how I can avoid this fatal error?

Kind regards
//neph

1 Like

Such errors have been reported recently. To get rid of the locking errors, you can put owncloud in maintenance-mode and empty the oc_file_locks-table.
If you run owncloud on your own server, you can install redis-cache to manage the file-locking. It is faster than mysql and hopefully results in fewer conflicts.

1 Like

Hej,

thank you for your reply. Unfortunately I have no idea how to empty the oc_file_locks-table and where? Directly in the database? If yes, what is the command?

Kind regards
//nephilim

Yes, it’s directly in the database. Truncate is the command you need:
http://dev.mysql.com/doc/refman/5.7/en/truncate-table.html

I had a similar issue after migrating from OC, but I re-scanned all the files:

sudo -u www-data php occ files:scan --all

This cleaned up all the files that were locked.

1 Like

Nextcloud 13.0.4 fixed some issues, now it is less likely that the error occurs.

But it still can occur, see https://github.com/nextcloud/server/issues/9305

Thank you! It worked for me too.

wwe: close old topics