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

8.1.1 + Encryption: Exception: {\"Message\":\"An exception occurred while executing 'INSERT INTO oc_filecache #18502

Closed
ghost opened this issue Aug 23, 2015 · 39 comments

Comments

@ghost
Copy link

ghost commented Aug 23, 2015

Steps to reproduce

  1. Start Owncloud - Client with 1Password - Folder or Pictures folder
  2. Wait
  3. See the log message stated in the title appear while the connection interrupts, sync is not possible.

Expected behaviour

Complete sync of the folders stated above

Actual behaviour

Client reports: "Connection closed/interrupted" (Vorgang abgebrochen)

Server configuration

Operating system:
Raspbian Wheezy

Web server:
Nginx 1.9.4

Database:
MySQL

PHP version:
5.4.41

ownCloud version: (see ownCloud admin page)
8.1.1
Updated from an older ownCloud or fresh install:
fresh install

List of activated apps:
Enabled:

  • activity: 2.0.1
  • files: 1.1.10
  • files_locking:
  • files_pdfviewer: 0.7
  • files_sharing: 0.6.2
  • files_texteditor: 0.4
  • files_trashbin: 0.6.3
  • files_versions: 1.0.6
  • files_videoviewer: 0.1.3
  • firstrunwizard: 1.1
  • gallery: 0.6.0
  • provisioning_api: 0.2
  • templateeditor: 0.1
  • updater: 0.6

The content of config/config.php:

<?php
$CONFIG = array (
*** salt and instance id removed ***

  'trusted_domains' =>
  array (
    0 => 'example.de',
  ),
  'datadirectory' => '/srv/www/oc-data',
  'overwrite.cli.url' => 'https://example.de/owncloud',
  'dbtype' => 'mysql',
  'version' => '8.1.1.3',
  'dbname' => 'oc_db',
  'dbhost' => 'localhost',
  'dbtableprefix' => ***
  'dbuser' => ***
  'dbpassword' => ***
  'logtimezone' => 'Europe/Berlin',
  'installed' => true,
  'mail_from_address' => 'webmaster',
  'mail_smtpmode' => 'php',
  'mail_domain' => 'example.de',
  'memcache.local' => '\\OC\\Memcache\\APC',
  'loglevel' => 3,
);

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

Are you using encryption: yes/no
Yes

Client configuration

Owncloud Sync Client

Operating system:
Windows 10

Log

ownCloud log (data/owncloud.log)

{"reqId":"Vizi30N8NXSa\/jo2hYzT","remoteAddr":"IP ADDRESS","app":"webdav","message":"Exception: {\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`encrypted`,`parent`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0' with params [\\\"3\\\", \\\"8\\\", 1440107331, 906, \\\"64108a6d100693f566cb6a4382a516ab\\\", 1440107331, 27, 1, \\\"67\\\", \\\"8f43ac16cdb5d9ba8da70e8b1a7df19a\\\", \\\"files\\\\\\\/1Password\\\\\\\/1Password.agilekeychain\\\\\\\/data\\\\\\\/default\\\\\\\/3F6CEFFE0B634D2094A1247B4234C079.1password\\\", \\\"3F6CEFFE0B634D2094A1247B4234C079.1password\\\", \\\"1\\\", \\\"1\\\", \\\"8f43ac16cdb5d9ba8da70e8b1a7df19a\\\"]:\\n\\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-8f43ac16cdb5d9ba8da70e8b1a7df19a' for key 'fs_storage_path_hash'\",\"Code\":0,\"Trace\":\"
#0 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/DBALException.php(116): Doctrine\\\\DBAL\\\\Driver\\\\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\\\\DBAL\\\\Driver\\\\PDOException))\\n
#1 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/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 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(151): Doctrine\\\\DBAL\\\\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\\n
#3 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/db\\\/adapter.php(93): OC\\\\DB\\\\Connection->executeUpdate('INSERT INTO `*P...', Array)\\n
#4 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/db\\\/connection.php(190): OC\\\\DB\\\\Adapter->insertIfNotExist('*PREFIX*filecac...', Array, Array)\\n
#5 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/cache.php(322): OC\\\\DB\\\\Connection->insertIfNotExist('*PREFIX*filecac...', Array, Array)\\n
#6 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(225): OC\\\\Files\\\\Cache\\\\Cache->put('files\\\/1Password...', Array)\\n
#7 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/files\\\/cache\\\/scanner.php(188): OC\\\\Files\\\\Cache\\\\Scanner->addToCache('files\\\/1Password...', Array, -1)\\n
#8 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/connector\\\/sabre\\\/file.php(208): OC\\\\Files\\\\Cache\\\\Scanner->scanFile('files\\\/1Password...')\\n
#9 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/lib\\\/private\\\/connector\\\/sabre\\\/directory.php(113): OC\\\\Connector\\\\Sabre\\\\File->put(Resource id #26)\\n
#10 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(1053): OC\\\\Connector\\\\Sabre\\\\Directory->createFile('3F6CEFFE0B634D2...', Resource id #26)\\n
#11 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(513): Sabre\\\\DAV\\\\Server->createFile('1Password\\\/1Pass...', Resource id #26, NULL)\\n
#12 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpPut(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n
#13 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n
#14 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(469): Sabre\\\\Event\\\\EventEmitter->emit('method:PUT', Array)\\n
#15 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n
#16 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/apps\\\/files\\\/appinfo\\\/remote.php(83): Sabre\\\\DAV\\\\Server->exec()\\n
#17 \\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/remote.php(132): require_once('\\\/var\\\/www\\\/virtua...')\\n
#18 {main}\",\"File\":\"\\\/var\\\/www\\\/virtual\\\/mfin\\\/html\\\/owncloud\\\/3rdparty\\\/doctrine\\\/dbal\\\/lib\\\/Doctrine\\\/DBAL\\\/Driver\\\/AbstractMySQLDriver.php\",\"Line\":66}","level":4,"time":"2015-08-20T21:48:51+00:00"}

Webserver log (nginx.log) shows nothing but "an upstream response is buffered to a temporary file"...i don't know how to solve the problem...i own the server, permissions are set correctly, it seems to be an issue with the encryption module because on an unencrypted install, the error does not appear.

@karlitschek
Copy link
Contributor

@schiesbn any idea?

@PVince81
Copy link
Contributor

I got this happening randomly as well on master with encryption enabled, uploading a folder with 70 pictures in it. Could be a race condition, but I don't see where. Maybe the cache update/propagation from the previous file isn't finished yet while the next file upload is trying to propagate too and touch the same entries. This should hopefully disappear when enabling transactional file locking: https://doc.owncloud.org/server/8.1/admin_manual/configuration_files/files_locking_transactional.html

@Bobuscho does it happen randomly or always with the same files ?

@PVince81
Copy link
Contributor

I tried with enabled transactional locking, but I'm still seeing the errors randomly.

CC @icewind1991

@PVince81
Copy link
Contributor

I got this again and it seems the cache update succeeded, but wrote the wrong size. Having a file with the wrong size breaks the sync client when it tries to download it since it's waiting for more data that doesn't come (Connection closed).

The question is why the cache update clash is happening in the first place.

@PVince81
Copy link
Contributor

even when filesystem_check_changes is 0

@PVince81
Copy link
Contributor

Now I can't make the exception appear again, but I still get sync failures. Nothing in the log. 😦

@PVince81
Copy link
Contributor

Okay, so I got it again. But I suspect these might be different issues:

{"reqId":"8Fs7YY3lyQQGkMJfuy25","remoteAddr":"127.0.0.1","app":"webdav","message":"Exception: {\"Message\":\"An exception occurred while executing 'INSERT INTO `oc_filecache` (`mimepart`,`mimetype`,`mtime`,`size`,`etag`,`storage_mtime`,`permissions`,`encrypted`,`parent`,`path_hash`,`path`,`name`,`storage`) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM `oc_filecache` WHERE `storage` = ? AND `path_hash` = ? HAVING COUNT(*) = 0' with params [\"5\", \"9\", 1440514477, 2942330, \"f78fc4baa73cc4dba27d86000e63c358\", 1440514477, 27, 1, \"18\", \"d2a87ac1d6e18c16a6d02220b3415353\", \"files\/Food\/P1040030.JPG\", \"P1040030.JPG\", \"1\", \"1\", \"d2a87ac1d6e18c16a6d02220b3415353\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-d2a87ac1d6e18c16a6d02220b3415353' for key 'fs_storage_path_hash'\",\"Code\":0,\"Trace\":\"
#0 /srv/www/htdocs/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(116): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))\n
#1 /srv/www/htdocs/owncloud/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 /srv/www/htdocs/owncloud/lib/private/db/connection.php(151): Doctrine\DBAL\Connection->executeUpdate('INSERT INTO `oc...', Array, Array)\n
#3 /srv/www/htdocs/owncloud/lib/private/db/adapter.php(93): OC\DB\Connection->executeUpdate('INSERT INTO `*P...', Array)\n
#4 /srv/www/htdocs/owncloud/lib/private/db/connection.php(190): OC\DB\Adapter->insertIfNotExist('*PREFIX*filecac...', Array, Array)\n
#5 /srv/www/htdocs/owncloud/lib/private/files/cache/cache.php(322): OC\DB\Connection->insertIfNotExist('*PREFIX*filecac...', Array, Array)\n
#6 /srv/www/htdocs/owncloud/lib/private/files/cache/scanner.php(225): OC\Files\Cache\Cache->put('files/Food/P104...', Array)\n
#7 /srv/www/htdocs/owncloud/lib/private/files/cache/scanner.php(188): OC\Files\Cache\Scanner->addToCache('files/Food/P104...', Array, -1)\n
#8 /srv/www/htdocs/owncloud/lib/private/files/cache/scanner.php(265): OC\Files\Cache\Scanner->scanFile('files/Food/P104...', 3, -1, NULL, false)\n
#9 /srv/www/htdocs/owncloud/lib/private/files/cache/updater.php(114): OC\Files\Cache\Scanner->scan('files/Food/P104...', false, -1, false)\n
#10 /srv/www/htdocs/owncloud/lib/private/connector/sabre/file.php(211): OC\Files\Cache\Updater->update('/Food/P1040030....')\n
#11 /srv/www/htdocs/owncloud/lib/private/connector/sabre/directory.php(113): OC\Connector\Sabre\File->put(Resource id #264)\n
#12 /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(1053): OC\Connector\Sabre\Directory->createFile('P1040030.JPG', Resource id #264)\n
#13 /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(513): Sabre\DAV\Server->createFile('Food/P1040030.J...', Resource id #264, NULL)\n
#14 [internal function]: Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n
#15 /srv/www/htdocs/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n
#16 /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(469): Sabre\Event\EventEmitter->emit('method:PUT', Array)\n
#17 /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(254): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\n
#18 /srv/www/htdocs/owncloud/apps/files/appinfo/remote.php(83): Sabre\DAV\Server->exec()\n
#19 /srv/www/htdocs/owncloud/remote.php(132): require_once('/srv/www/htdocs...')\n
#20 {main}\",\"File\":\"/srv/www/htdocs/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php\",\"Line\":66}","level":4,"time":"2015-08-25T14:54:37+00:00","method":"PUT","url":"/owncloud/remote.php/webdav/Food/P1040030.JPG"}

@PVince81
Copy link
Contributor

I suspect it might be happening whenever the sync client tries to get the quota while an upload is in progress.

@PVince81
Copy link
Contributor

The test above was without transactional locking on stable8.1

Now trying with transactional locking enabled on stable8.1 the exception with file cache doesn't want to reappear...

@PVince81
Copy link
Contributor

Okay, looks like if I disable the debugger/breakpoint the second issue, the one with no logs, appears again. Also I saw this in the error_log:

[Tue Aug 25 17:15:08.054218 2015] [php5:error] [pid 10089] [client 127.0.0.1:36943] PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'DirectoryIterator::__construct(/srv/www/htdocs/owncloud/3rdparty/ircmaxell/random-lib/lib/RandomLib/Mixer): failed to open dir: Too many open files' in /srv/www/htdocs/owncloud/3rdparty/ircmaxell/security-lib/lib/SecurityLib/AbstractFactory.php:72\nStack trace:\
n#0 /srv/www/htdocs/owncloud/3rdparty/ircmaxell/security-lib/lib/SecurityLib/AbstractFactory.php(72): DirectoryIterator->__construct('/srv/www/htdocs...')\
n#1 /srv/www/htdocs/owncloud/3rdparty/ircmaxell/random-lib/lib/RandomLib/Factory.php(204): SecurityLib\AbstractFactory->loadFiles('/srv/www/htdocs...', 'RandomLib\Mixer...', Array)\
n#2 /srv/www/htdocs/owncloud/3rdparty/ircmaxell/random-lib/lib/RandomLib/Factory.php(48): RandomLib\Factory->loadMixers()\
n#3 /srv/www/htdocs/owncloud/lib/private/security/securerandom.php(46): RandomLib\Factory->__construct()\
n#4 /srv/www/htdocs/owncloud/lib/private/server.php(285): OC\Security\SecureRandom->__construct()\
n#5 /srv/www/htdocs/owncloud/3rdparty/pimple/pi in /srv/www/htdocs/owncloud/3rdparty/ircmaxell/security-lib/lib/SecurityLib/AbstractFactory.php on line 72

This is the bug from XDebug. So let's disable the debugger completely and retest with transactional file locking.

@PVince81
Copy link
Contributor

Ok, with XDebug disabled I can't reproduce the issue with transactional locking enabled.

The purpose of locking is to avoid random concurrency issues. @Bobuscho could you give it a try: https://doc.owncloud.org/server/8.1/admin_manual/configuration_files/files_locking_transactional.html and see if it solves the issue for you ?

@ghost
Copy link
Author

ghost commented Aug 26, 2015

PVince81, thank you very much for your testing. I'll be back at home tomorrow or at Friday, so i will test it asap when i come home! Meanwhile i enabled the file locking and install redis etc, but i need some time to test it with encrypted data.

@ghost
Copy link
Author

ghost commented Aug 28, 2015

I've enabled encryption and tried to sync a new folder with my 1Password files. The admin page states that file locking is enabled, redis is running fine. Sync still fails with output:

Exception: {"Message":"Could not obtain lock type 1 on \"\/srv\/www\/oc-data\/mfinkeldey\/files\/1Passwordtest\/1Password.agilekeychain\/data\/default\/F55968AF9960452180AC7017E8A7D019.1password.ocTransferId693554407.part\".","Code":0,"Trace":"
#0 \/srv\/www\/owncloud\/apps\/files_locking\/lib\/lockingwrapper.php(45): OCA\\Files_Locking\\Lock->addLock(1, Resource id #312)\n
#1 \/srv\/www\/owncloud\/apps\/files_locking\/lib\/lockingwrapper.php(172): OCA\\Files_Locking\\LockingWrapper->getLock('files\/1Password...', 1, Resource id #312)\n
#2 \/srv\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(624): OCA\\Files_Locking\\LockingWrapper->fopen('files\/1Password...', 'r')\n
#3 \/srv\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(692): OC\\Files\\Storage\\Wrapper\\Encryption->readFirstBlock('files\/1Password...')\n
#4 \/srv\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(722): OC\\Files\\Storage\\Wrapper\\Encryption->getHeader('files\/1Password...')\n
#5 \/srv\/www\/owncloud\/lib\/private\/files\/storage\/wrapper\/encryption.php(217): OC\\Files\\Storage\\Wrapper\\Encryption->getEncryptionModule('files\/1Password...')\n
#6 [internal function]: OC\\Files\\Storage\\Wrapper\\Encryption->unlink('files\/1Password...')\n
#7 \/srv\/www\/owncloud\/apps\/files_trashbin\/lib\/storage.php(143): call_user_func_array(Array, Array)\n
#8 \/srv\/www\/owncloud\/apps\/files_trashbin\/lib\/storage.php(94): OCA\\Files_Trashbin\\Storage->doDelete('files\/1Password...', 'unlink')\n
#9 \/srv\/www\/owncloud\/lib\/private\/connector\/sabre\/file.php(150): OCA\\Files_Trashbin\\Storage->unlink('files\/1Password...')\n
#10 \/srv\/www\/owncloud\/lib\/private\/connector\/sabre\/directory.php(113): OC\\Connector\\Sabre\\File->put(Resource id #209)\n
#11 \/srv\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(1053): OC\\Connector\\Sabre\\Directory->createFile('F55968AF9960452...', Resource id #209)\n
#12 \/srv\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php(513): Sabre\\DAV\\Server->createFile('1Passwordtest\/1...', Resource id #209, NULL)\n
#13 [internal function]: Sabre\\DAV\\CorePlugin->httpPut(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n
#14 \/srv\/www\/owncloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\n
#15 \/srv\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(469): Sabre\\Event\\EventEmitter->emit('method:PUT', Array)\n
#16 \/srv\/www\/owncloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php(254): Sabre\\DAV\\Server->invokeMethod(Object(Sabre\\HTTP\\Request), Object(Sabre\\HTTP\\Response))\n
#17 \/srv\/www\/owncloud\/apps\/files\/appinfo\/remote.php(83): Sabre\\DAV\\Server->exec()\n
#18 \/srv\/www\/owncloud\/remote.php(132): require_once('\/srv\/www\/ownclo...')\n
#19 {main}","File":"\/srv\/www\/owncloud\/apps\/files_locking\/lib\/lock.php","Line":257} 

Without encryption activated, everything runs fine.

@PVince81
Copy link
Contributor

@icewind1991 @schiesbn looks like a double-locking issue ?

@ghost
Copy link
Author

ghost commented Aug 28, 2015

PVince81, i am not sure. I disabled the external storage app and the error disappears and the files sync without any problems, even if encryption and locking is enabled. Maybe the external storage app causes the problem?

@icewind1991
Copy link
Contributor

Note that this is the flock based lockin app, not the new transitional locking

@ghost
Copy link
Author

ghost commented Aug 29, 2015

Okay, i have tested another few things by disabling every Owncloud App one by one.
Result: Encryption + External storage + transitional file locking enabled works, but only if i disable the Pictures app.

Maybe this is useful to narrow down the cause of this error...

Edit: Too soon...Error is still there:

Exception: {"Message":"An exception occurred while executing 'INSERT INTO oc_filecache (mimepart,mimetype,mtime,size,etag,storage_mtime,permissions,encrypted,parent,path_hash,path,name,storage) SELECT ?,?,?,?,?,?,?,?,?,?,?,?,? FROM oc_filecache WHERE storage = ? AND path_hash = ? HAVING COUNT() = 0' with params [\"3\", \"8\", 1440884370, 1070, \"1097353ae4ba30d762baa7835b4c58bd\", 1440884370, 27, 1, \"15691\", \"a1958de12842cd5b2bf77075b239cc21\", \"files/1Password/1Password.agilekeychain/data/default/365A4FFFBBF846578C14FF785D9361FF.1password\", \"365A4FFFBBF846578C14FF785D9361FF.1password\", \"1\", \"1\", \"a1958de12842cd5b2bf77075b239cc21\"]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-a1958de12842cd5b2bf77075b239cc21' for key 'fs_storage_path_hash'","Code":0,"Trace":"
n#0 /srv/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php(116): Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))\
n#1 /srv/www/owncloud/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 /srv/www/owncloud/lib/private/db/connection.php(151): Doctrine\DBAL\Connection->executeUpdate('INSERT INTOoc...', Array, Array)\
n#3 /srv/www/owncloud/lib/private/db/adapter.php(93): OC\DB\Connection->executeUpdate('INSERT INTO `P...', Array)\
n#4 /srv/www/owncloud/lib/private/db/connection.php(190): OC\DB\Adapter->insertIfNotExist('PREFIXfilecac...', Array, Array)\
n#5 /srv/www/owncloud/lib/private/files/cache/cache.php(322): OC\DB\Connection->insertIfNotExist('PREFIXfilecac...', Array, Array)\
n#6 /srv/www/owncloud/lib/private/files/cache/scanner.php(225): OC\Files\Cache\Cache->put('files/1Password...', Array)\
n#7 /srv/www/owncloud/lib/private/files/cache/scanner.php(188): OC\Files\Cache\Scanner->addToCache('files/1Password...', Array, -1)\
n#8 /srv/www/owncloud/lib/private/connector/sabre/file.php(211): OC\Files\Cache\Scanner->scanFile('files/1Password...')\
n#9 /srv/www/owncloud/lib/private/connector/sabre/directory.php(113): OC\Connector\Sabre\File->put(Resource id #201)\
n#10 /srv/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(1053): OC\Connector\Sabre\Directory->createFile('365A4FFFBBF8465...', Resource id #201)\
n#11 /srv/www/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php(513): Sabre\DAV\Server->createFile('1Password/1Pass...', Resource id #201, NULL)\
n#12 [internal function]: Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\
n#13 /srv/www/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\
n#14 /srv/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(469): Sabre\Event\EventEmitter->emit('method:PUT', Array)\
n#15 /srv/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php(254): Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))\
n#16 /srv/www/owncloud/apps/files/appinfo/remote.php(83): Sabre\DAV\Server->exec()\
n#17 /srv/www/owncloud/remote.php(132): require_once('/srv/www/ownclo...')\
n#18 {main}","File":"/srv/www/owncloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php","Line":66}

@cdamken
Copy link
Contributor

cdamken commented Sep 14, 2015

Description

We sync 320.000,00 Documents with 107 GB.
After restart the client syncs round about 400 MB every 30 minutes with round about 1500 documents.
An after time - the sync files (see screenshot from yesterday).

Expected behaviour

Sync all the files

Actual behaviour

Don't sync all the files 😞

Server configuration

Operating system:
FreeBSD s4.peakserver.net 9.3-RELEASE-p5 FreeBSD 9.3-RELEASE-p5

Web server:
Server version: Apache/2.2.17 (FreeBSD)


Apache modules enabled as declared in:
core itk
http_core
mod_so
mod_authn_file
mod_authn_dbm
mod_authn_anon
mod_authn_default
mod_authn_alias
mod_authz_host
mod_authz_groupfile
mod_authz_user
mod_authz_dbm
mod_authz_owner
mod_authz_default
mod_auth_basic
mod_auth_digest
mod_file_cache
mod_cache
mod_disk_cache
mod_dumpio
mod_reqtimeout
mod_include
mod_filter
mod_charset_lite
mod_deflate
mod_log_config
mod_logio
mod_env
mod_mime_magic
mod_cern_meta
mod_expires
mod_headers
mod_usertrack
mod_unique_id
mod_setenvif
mod_version
mod_ssl
mod_mime
mod_dav
mod_autoindex
mod_asis
mod_info
mod_cgi
mod_dav_fs
mod_vhost_alias
mod_negotiation
mod_dir
mod_imagemap
mod_actions
mod_speling
mod_userdir
mod_alias
mod_rewrite
mod_bw
mod_fastcgi
mod_php5

Database:
mysqlnd 5.0.10 - 20111026

PHP version:
PHP Version 5.4.13

ownCloud version:
{"installed":true,"maintenance":false,"version":"8.1.1.3","versionstring":"8.1.1","edition":"Enterprise"}

Updated from an older ownCloud or fresh install:
Fresh install

List of activated apps:

Activity
Default encryption
deleted files
enterprise license key
external sites
external storage
file locking
files drop
firewall
first run wizard
log file sharing
log user action
mail template editor
pdf viewer
pictures
provisioning api
share files
text editor
updater
video viewer
antivirus app

The content of config/config.php:

<?php
$CONFIG = array (
  'appstoreenabled' => false,
  'has_internet_connection' => false,
  'supportedDatabases' => 
  array (
    0 => 'mysql',
    1 => 'pgsql',
    2 => 'oci',
  ),
  'instanceid' => 'XXXXXXX',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => 'XXXXXXX',
  ),
  'datadirectory' => '/storage/web/web0021/web/data',
  'overwrite.cli.url' => 'XXXXXXX',
  'dbtype' => 'mysql',
  'version' => '8.1.1.3',
  'dbname' => 'XXXXXXX',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'XXXXXXX',
  'dbpassword' => 'XXXXXXX',
  'installed' => true,
  'license-key' => '',
  'forcessl' => true,
  'loglevel' => 2,
  'cipher' => 'AES-256-CFB',
  'mail_smtpmode' => 'php',
  'mail_from_address' => 'administrator',
  'mail_domain' => 'XXXXXXX',
  'theme' => 'XXXXXXX',
  'enable_previews' => true,
  'preview_max_x' => NULL,
  'preview_max_y' => NULL,
  'preview_max_scale_factor' => 10,
  'preview_libreoffice_path' => '/usr/local/bin/libreoffice',
  'preview_office_cl_parameters' => ' --headless --nologo --nofirststartwizard --invisible --norestore -convert-to pdf -outdir ',
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Image',
    1 => 'OC\\Preview\\MP3',
    2 => 'OC\\Preview\\TXT',
    3 => 'OC\\Preview\\MarkDown',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOffice2007',
    6 => 'OC\\Preview\\MSOfficeDoc',
    7 => 'OC\\Preview\\OpenDocument',
    8 => 'OC\\Preview\\PDF',
    9 => 'OC\\Preview\\StarOffice',
    10 => 'OC\\Preview\\SVG',
  ),
  'rules' => '[{}]',
  'maintenance' => false,
  'debug' => '0',
  'default_language' => 'de',
);

Are you using external storage, if yes which one:
Local

Are you using encryption:
yes

Are you using an external user-backend, if yes which one:

No

Client configuration

Sync-Client 2.0.1 and 1.8.4 (Just for testing)

Operating system:
Windows and Mac

Logs

ownCloud logs, server and client. apache logs
S3-ownCloud\Shared\owncloud\support\github-issues\core\18502

@schiesbn I will ask about the testing you told on the phone.

@MorrisJobke

00003788

@cdamken
Copy link
Contributor

cdamken commented Sep 17, 2015

@schiesbn I put the new log files with the patch you provided to me:

S3-ownCloud\Shared\owncloud\support\github-issues\core\18502\NEW2

@cdamken
Copy link
Contributor

cdamken commented Sep 18, 2015

@schiesbn @PVince81 Your recomendation `filesystem_check_changes => 0;`` in the config.php sounds really good because with encryption is not needed to check all the time the data folder.

After a few hours where not so many error, but this one seems weird:

screenshot-new

@guruz @danimo Any clue? I'm trying to get the log file when the error happens again.

@PVince81
Copy link
Contributor

@cdamken any matching server logs ?

@cdamken
Copy link
Contributor

cdamken commented Sep 21, 2015

@PVince81 I have to ask for them, about the the QT problem I talked with @dragotin and it looks like a Linux-QT problem.

Actually I don't see many errors in the client. It looks solved.. I have to wait.

@Bobuscho Do you still have the problem?

@cdamken
Copy link
Contributor

cdamken commented Sep 24, 2015

So far I uploaded successfully:
152.387 items, totalling 1,5 GB

I'm waiting for my customer for his feedback if for him did work fine too.

@cdamken
Copy link
Contributor

cdamken commented Sep 28, 2015

Hi Guys,

I confirmed with my customer: the filesystem_check_changes => 0; provided the right solution!

If @Bobuscho doesn't have more information about it I would said that it is the solution. From my side it's solved.

Thanks a lot!

@felixboehm
Copy link
Contributor

While this works with a workaround, we should fix this sometime.
@MTRichards Please provide a milestone.

@MTRichards
Copy link
Contributor

Yeah ok, but fix what?

@felixboehm
Copy link
Contributor

Still an exception with locking enabled: #18502 (comment)
The workaround filesystem_check_changes => 0; only worked for @cdamken, right?

@oriol-corbella
Copy link

@felixboehm I have a similar problem, but not sure if it's the same, that has not been fixed with the "filesystem_check_changes => 0;"...
Here is my problem: #20501

@oriol-corbella
Copy link

Disabling the Encryption app doesn't solve the problem. Also disabling other apps (like files, external and locking, or dashboard, roundcube, tasks, contacts, calendar...) gives the same result.

@oriol-corbella
Copy link

Any idea, anyone?

I will have to do a fresh install from zero then...

@cdamken
Copy link
Contributor

cdamken commented Dec 1, 2015

@felixboehm I have a similar problem, but not sure if it's the same, that has not been fixed with the "filesystem_check_changes => 0;"...
Here is my problem: #20501

as you described, you erased the oc_filecache, that is not good.

I think your problem is because the sqlite:

'dbtype' => 'sqlite3',

@oriol-corbella
Copy link

I just erased the oc_filecache for testing, I have a backup of it and I restored it.
So, what do you think should I do with the sqlite?

Thanks.

@brevilo
Copy link

brevilo commented Dec 19, 2015

What's the state of this? I also get this error with a fresh install of 8.2.1 (using MySQL 5.1) and OSX sync client 2.1.0 on the first sync attempt (single user). The previous workaround of setting filesystem_check_changes = 0 is obviously ineffective since that's its default value since 8.2.

Also, what's the actual impact of this bug?

@PVince81
Copy link
Contributor

@brevilo do you have a log with stack trace ? Could help finding out which code path led to this.

With "filesystem_check_changes" set to 0 and transactional file locking enabled (default enabled in 8.2.x) this shouldn't happen any more.

@brevilo
Copy link

brevilo commented Dec 21, 2015

@PVince81 no, unfortunately not, and in the meantime I dropped server-side encryption (reinstalled ownCloud) because of this. Now using client-side encryption. No errors so far so this might indeed be a side-effect of using server-side encryption.

@oriol-corbella
Copy link

I also ended reinstalling from zero my OwnCloud...

@enoch85
Copy link
Member

enoch85 commented May 24, 2016

Is this issue still valid?

@oriol-corbella
Copy link

I guess so... As I said I had to reinstall from zero my ownCloud.

@PVince81
Copy link
Contributor

PVince81 commented Jul 7, 2016

@PVince81 PVince81 closed this as completed Jul 7, 2016
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

9 participants