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

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO oc_file_locks #8826

Closed
tapete opened this issue Mar 14, 2018 · 6 comments

Comments

@tapete
Copy link

tapete commented Mar 14, 2018

Steps to reproduce

  1. Fresh install nextcloud 13.0.0
  2. Install Desktop client 2.3.3 to desktop A
  3. Sync Data From desktop A to nextcloud
  4. Install Desktop client 2.3.3 to desktop B
  5. Sync Data from nextcloud to desktop B

Expected behaviour

Desktop A and desktop B should be synced.

Actual behaviour

Server Error in step 4.

Server configuration

Operating system:
Ubuntu 16.04.3

Web server:
apache 2.4.18

Database:
MySQL 5.7.21

PHP version:
7.0.22

Nextcloud version: (see Nextcloud admin page)
13.0.0

Updated from an older Nextcloud/ownCloud or fresh install:
fresh install

Where did you install Nextcloud from:
downloaded zip file from nextcloud.com

Signing status:

Signing status No errors have been found.

List of activated apps:

App list Enabled: - activity: 2.6.1 - audioplayer: 2.2.5 - calendar: 1.6.1 - comments: 1.3.0 - contacts: 2.1.2 - dav: 1.4.6 - federatedfilesharing: 1.3.1 - federation: 1.3.0 - files: 1.8.0 - files_pdfviewer: 1.2.0 - files_sharing: 1.5.0 - files_texteditor: 2.5.1 - files_trashbin: 1.3.0 - files_versions: 1.6.0 - files_videoplayer: 1.2.0 - firstrunwizard: 2.2.1 - gallery: 18.0.0 - logreader: 2.0.0 - lookup_server_connector: 1.1.0 - nextcloud_announcements: 1.2.0 - notifications: 2.1.2 - oauth2: 1.1.0 - password_policy: 1.3.0 - provisioning_api: 1.3.0 - radio: 0.6.1 - serverinfo: 1.3.0 - sharebymail: 1.3.0 - survey_client: 1.1.0 - systemtags: 1.3.0 - theming: 1.4.1 - twofactor_backupcodes: 1.2.3 - updatenotification: 1.3.0 - workflowengine: 1.3.0 Disabled: - admin_audit - encryption - files_external - user_external - user_ldap

Nextcloud configuration:

Config report { "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "REMOVED" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "https:REMOVED", "dbtype": "mysql", "version": "13.0.0.14", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true } }

Are you using external storage, if yes which one: local/smb/sftp/...
no

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

Client configuration

Browser:
not used

Operating system:
Windows 8

Logs

Web server error log

Web server error log no errors in apache error log

Nextcloud log (data/nextcloud.log)

Nextcloud log
{"reqId":"IZayWr9u8RlHbPF4jkSz","level":4,"time":"2018-03-14T21:26:23+00:00","remoteAddr":"88.130.91.85","user":"REMOVED","app":"webdav","method":"GET","url":"\/remote.php\/dav\/files\/REMOVED\/Eigene%20Dateien\/Projekte\/Ubuntu%20Server\/REMOVED\/Downloads\/owncloud\/lib\/public\/appframework\/app.php","message":"Exception: {\"Exception\":\"Doctrine\\\\DBAL\\\\Exception\\\\UniqueConstraintViolationException\",\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`,`lock`,`ttl`) SELECT ?,?,? FROM `oc_file_locks` WHERE `key` = ? HAVING COUNT(*) = 0' with params [\\\"files\\\\\\\/588083b9b29a30143825e90a02e060fc\\\", 1, 1521066383, \\\"files\\\\\\\/588083b9b29a30143825e90a02e060fc\\\"]:\\n\\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'files\\\/588083b9b29a30143825e90a02e060fc' for key 'lock_key_index'\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(128): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n#1 \\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Connection.php(1015): Doctrine\\\\DBAL\\\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOMySql\\\\Driver), Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException), 'INSERT INTO `oc...', Array)\\n#2 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/DB\\\/Connection.php(216): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\\n#3 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/DB\\\/Adapter.php(114): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `oc...', Array)\\n#4 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/DB\\\/Connection.php(254): OC\\\\DB\\\\Adapter->insertIfNotExist('*PREFIX*file_lo...', Array, Array)\\n#5 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Lock\\\/DBLockingProvider.php(119): OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*file_lo...', Array, Array)\\n#6 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Lock\\\/DBLockingProvider.php(164): OC\\\\Lock\\\\DBLockingProvider->initLockField('files\\\/588083b9b...', 1)\\n#7 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/Storage\\\/Common.php(709): OC\\\\Lock\\\\DBLockingProvider->acquireLock('files\\\/588083b9b...', 1)\\n#8 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(592): OC\\\\Files\\\\Storage\\\\Common->acquireLock('files\\\/Eigene Da...', 1, Object(OC\\\\Lock\\\\DBLockingProvider))\\n#9 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/Storage\\\/Wrapper\\\/Wrapper.php(592): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->acquireLock('files\\\/Eigene Da...', 1, Object(OC\\\\Lock\\\\DBLockingProvider))\\n#10 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/View.php(1926): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->acquireLock('files\\\/Eigene Da...', 1, Object(OC\\\\Lock\\\\DBLockingProvider))\\n#11 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/View.php(2040): OC\\\\Files\\\\View->lockPath('\\\/Eigene Dateien...', 1)\\n#12 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/View.php(1134): OC\\\\Files\\\\View->lockFile('\\\/Eigene Dateien...', 1)\\n#13 \\\/var\\\/www\\\/html\\\/ssl443\\\/lib\\\/private\\\/Files\\\/View.php(987): OC\\\\Files\\\\View->basicOperation('fopen', '\\\/Eigene Dateien...', Array, 'r')\\n#14 \\\/var\\\/www\\\/html\\\/ssl443\\\/apps\\\/dav\\\/lib\\\/Connector\\\/Sabre\\\/File.php(337): OC\\\\Files\\\\View->fopen('Eigene Dateien\\\/...', 'r')\\n#15 \\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(85): OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File->get()\\n#16 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpGet(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#17 \\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#18 \\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:GET', Array)\\n#19 \\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#20 \\\/var\\\/www\\\/html\\\/ssl443\\\/apps\\\/dav\\\/lib\\\/Server.php(283): Sabre\\\\DAV\\\\Server->exec()\\n#21 \\\/var\\\/www\\\/html\\\/ssl443\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(35): OCA\\\\DAV\\\\Server->exec()\\n#22 \\\/var\\\/www\\\/html\\\/ssl443\\\/remote.php(164): require_once('\\\/var\\\/www\\\/html\\\/s...')\\n#23 {main}\",\"File\":\"\\\/var\\\/www\\\/html\\\/ssl443\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":66}","userAgent":"Mozilla\/5.0 (Windows) mirall\/2.3.3 (build 1) (Nextcloud)","version":"13.0.0.14"}
@tapete tapete changed the title Doctrine\DBAL\Exception\UniqueConstraintViolationException Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO oc_file_locks Mar 14, 2018
@tapete
Copy link
Author

tapete commented Apr 24, 2018

Since I switched to file locking with Redis, the error is gone. This is good news I think but it also means that the traditional file locking is broken.

@Temtaime
Copy link
Contributor

Temtaime commented May 9, 2018

This error is annoying and i have tons of it in my logs.
Also it makes desktop client stuck for a time.

@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jun 20, 2018
@MorrisJobke
Copy link
Member

Since I switched to file locking with Redis, the error is gone. This is good news I think but it also means that the traditional file locking is broken.

ref #7795

In more recent versions (13.0.4 and 12.0.9) we reduced drastically the amount of lock statements which should avoid most of the problems in here. Thus I will close it. If there is still stuff that breaks have a look at #9305 and it's linked issues.

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Jun 28, 2018
@MorrisJobke
Copy link
Member

Since I switched to file locking with Redis, the error is gone. This is good news I think but it also means that the traditional file locking is broken.

In more recent versions (13.0.4 and 12.0.9) we reduced drastically the amount of lock statements which should avoid most of the problems in here. Thus I will close it. If there is still stuff that breaks have a look at #9305 and it's linked issues.

@jirutka
Copy link

jirutka commented Jun 28, 2018

Since I switched to file locking with Redis, the error is gone. This is good news I think but it also means that the traditional file locking is broken.

The same here.

In more recent versions (13.0.4 and 12.0.9) we reduced drastically the amount of lock statements which should avoid most of the problems in here. Thus I will close it.

What? This is not a fix of the problem, just mitigation of the symptoms!

@MorrisJobke
Copy link
Member

What? This is not a fix of the problem, just mitigation of the symptoms!

And I also said, that #9305 will hold more information. That ticket is for the race conditions on the SQL side and #8239 is for the race conditions on the Redis side. We just want to consolidate tickets and find common patterns.

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

5 participants