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

UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO oc_filecache' #10580

Closed
ChristophWurst opened this issue Aug 8, 2018 · 4 comments

Comments

@ChristophWurst
Copy link
Member

ChristophWurst commented Aug 8, 2018

Steps to reproduce

  1. Don't know, found it via Sentry

Server configuration

Operating system: Debian 9

Web server: Apache

Database:: MySQL

PHP version: 7.0

Nextcloud version: 14 Beta 2

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

https://sentry.io/christoph-wurst/cloudwucme/issues/633839949/

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '27-80cbf37d64683fa0ca86bfdaa83caccd' for key 'fs_storage_path_hash'
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php", line 105, in execute
    return parent::execute($params);
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php", line 105, in execute
    return parent::execute($params);
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php", line 1008, in executeUpdate
    $stmt->execute($params);
  File "/var/www/nextcloud/lib/private/DB/Connection.php", line 216, in executeUpdate
    return parent::executeUpdate($query, $params, $types);
  File "/var/www/nextcloud/lib/private/DB/Adapter.php", line 114, in insertIfNotExist
    return $this->conn->executeUpdate($query, $inserts);
...
(28 additional frame(s) were not displayed)

Doctrine\DBAL\Driver\PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '27-80cbf37d64683fa0ca86bfdaa83caccd' for key 'fs_storage_path_hash'
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php", line 107, in execute
    throw new PDOException($exception);
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php", line 1008, in executeUpdate
    $stmt->execute($params);
  File "/var/www/nextcloud/lib/private/DB/Connection.php", line 216, in executeUpdate
    return parent::executeUpdate($query, $params, $types);
  File "/var/www/nextcloud/lib/private/DB/Adapter.php", line 114, in insertIfNotExist
    return $this->conn->executeUpdate($query, $inserts);
  File "/var/www/nextcloud/lib/private/DB/Connection.php", line 254, in insertIfNotExist
    return $this->adapter->insertIfNotExist($table, $input, $compare);
...
(27 additional frame(s) were not displayed)

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`parent`,`checksum`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0' with params ["3", "35", 1533643696, 0, "482a282f6d78c3e2a4d68c3411cbcd5e", 1533643696, 27, 297028, "", "80cbf37d64683fa0ca86bfdaa83caccd", "appdata_oc7434cf7ac3\/js\/files_sharing\/additionalScripts.js", "additionalScripts.js", 27, 27, "80cbf37d64683fa0ca86bfdaa83caccd"]:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '27-80cbf37d64683fa0ca86bfdaa83caccd' for key 'fs_storage_path_hash'
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php", line 66, in convertException
    return new Exception\UniqueConstraintViolationException($message, $exception);
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php", line 128, in driverExceptionDuringQuery
    return $driver->convertException($msg, $driverEx);
  File "/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php", line 1015, in executeUpdate
    throw DBALException::driverExceptionDuringQuery($this->_driver, $ex, $query, $this->resolveParams($params, $types));
  File "/var/www/nextcloud/lib/private/DB/Connection.php", line 216, in executeUpdate
    return parent::executeUpdate($query, $params, $types);
  File "/var/www/nextcloud/lib/private/DB/Adapter.php", line 114, in insertIfNotExist
    return $this->conn->executeUpdate($query, $inserts);
...
(28 additional frame(s) were not displayed)
@ChristophWurst
Copy link
Member Author

File "/var/www/nextcloud/lib/private/DB/Adapter.php", line 114, in insertIfNotExist

Sounds like a concurrency issue where the entry has been added in the meantime.

@ChristophWurst
Copy link
Member Author

cc @icewind1991

@ChristophWurst ChristophWurst added the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Aug 8, 2018
@nextcloud-bot
Copy link
Member

GitMate.io thinks possibly related issues are #6160 (Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO "oc_filecache" ), #7191 (Crash on start with An exception occurred while executing 'CREATE table oc_locks_w2g), #8826 (Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'INSERT INTO oc_file_locks), #6608 (Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing 'UPDATE oc_filecache), and #4749 (Doctrine\DBAL\Exception\DriverException: An exception occurred while executing 'INSERT INTO oc_properties (userid,propertypath,propertyname,propertyvalue) VALUES(?,?,?,?)').

@ChristophWurst
Copy link
Member Author

Yup, dup of #6160. Thanks @nextcloud-bot!

@ChristophWurst ChristophWurst removed the 0. Needs triage Pending check for reproducibility or if it fits our roadmap label Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants