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\DriverException: An exception occurred while executing 'INSERT INTO oc_filecache #12343

Closed
jcklpe opened this issue Nov 7, 2018 · 9 comments · Fixed by #12371
Labels

Comments

@jcklpe
Copy link

jcklpe commented Nov 7, 2018

Steps to reproduce

I'm not really sure. Server was having some trouble yesterday, (issue can be found [here]. This appears to be a separate issue though. It could be caused by the same thing, namely the fact that I just set up my phone to instant upload via web dav to my server.

Expected behaviour

To be available. Usable etc.

Actual behaviour

Not available. Unable to access server from external addresses. Can only access it from localhost.

Server configuration detail

Operating system: Linux 4.15.0-38-generic #41-Ubuntu SMP Wed Oct 10 10:59:38 UTC 2018 x86_64

Webserver: nginx/1.14.0 (fpm-fcgi)

Database: mysql 10.1.34

PHP version:

7.2.11-4+ubuntu18.04.1+deb.sury.org+1
Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, sodium, session, standard, cgi-fcgi, mysqlnd, PDO, xml, apcu, bz2, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, igbinary, imagick, intl, json, exif, mysqli, pdo_mysql, apc, posix, readline, redis, shmop, SimpleXML, smbclient, sockets, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Phar, libsmbclient, Zend OPcache

Nextcloud version: 14.0.3 - 14.0.3.0

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: unknown

Signing status

Array
(
)

List of activated apps
Enabled:
 - accessibility: 1.0.1
 - activity: 2.7.0
 - admin_audit: 1.4.0
 - admin_notifications: 1.0.2
 - audioplayer: 2.4.1
 - bruteforcesettings: 1.1.0
 - cloud_federation_api: 0.0.1
 - cms_pico: 0.9.7
 - comments: 1.4.0
 - dav: 1.6.0
 - dropit: 0.1.1
 - federatedfilesharing: 1.4.0
 - federation: 1.4.0
 - files: 1.9.0
 - files_accesscontrol: 1.4.0
 - files_automatedtagging: 1.4.0
 - files_external: 1.5.0
 - files_pdfviewer: 1.3.2
 - files_rightclick: 0.8.4
 - files_sharing: 1.6.2
 - files_texteditor: 2.6.0
 - files_trashbin: 1.4.1
 - files_versions: 1.7.1
 - files_videoplayer: 1.3.0
 - gallery: 18.1.0
 - groupfolders: 1.3.3
 - impersonate: 1.1.0
 - issuetemplate: 0.4.0
 - logreader: 2.0.0
 - lookup_server_connector: 1.2.0
 - music: 0.9.2
 - nextcloud_announcements: 1.3.0
 - notifications: 2.2.1
 - oauth2: 1.2.1
 - onlyoffice: 2.0.4
 - password_policy: 1.4.0
 - provisioning_api: 1.4.0
 - quota_warning: 1.3.0
 - ransomware_protection: 1.2.0
 - serverinfo: 1.4.0
 - sharebymail: 1.4.0
 - sharerenamer: 2.2.0
 - spreed: 4.0.0
 - support: 1.0.0
 - survey_client: 1.2.0
 - systemtags: 1.4.0
 - theming: 1.5.0
 - theming_customcss: 1.1.0
 - twofactor_backupcodes: 1.3.1
 - updatenotification: 1.4.1
 - workflowengine: 1.4.0
Disabled:
 - encryption
 - end_to_end_encryption
 - files_external_gdrive
 - firstrunwizard
 - richdocuments
 - user_external
 - user_ldap

Configuration (config/config.php)
{
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "localhost",
        "cloud.jackalope.tech",
        "wiki.jackalope.tech"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "https:\/\/cloud.jackalope.tech",
    "dbtype": "mysql",
    "version": "14.0.3.0",
    "dbname": "***REMOVED SENSITIVE VALUE***",
    "dbhost": "***REMOVED SENSITIVE VALUE***",
    "dbport": "",
    "dbtableprefix": "oc_",
    "mysql.utf8mb4": true,
    "dbuser": "***REMOVED SENSITIVE VALUE***",
    "dbpassword": "***REMOVED SENSITIVE VALUE***",
    "installed": true,
    "instanceid": "***REMOVED SENSITIVE VALUE***",
    "mail_from_address": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpmode": "smtp",
    "mail_smtpauthtype": "LOGIN",
    "mail_domain": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpsecure": "tls",
    "mail_smtpauth": "1",
    "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
    "mail_smtpport": "587",
    "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
    "memcache.local": "\\OC\\Memcache\\APCu",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": "0",
        "timeout": "0.0"
    },
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "filelocking.enabled": "true",
    "enable_previews": "true",
    "enabledPreviewProviders": [
        "OC\\Preview\\PNG",
        "OC\\Preview\\JPEG",
        "OC\\Preview\\GIF",
        "OC\\Preview\\BMP",
        "OC\\Preview\\XBitmap",
        "OC\\Preview\\Movie",
        "OC\\Preview\\PDF",
        "OC\\Preview\\MP3",
        "OC\\Preview\\TXT",
        "OC\\Preview\\MarkDown"
    ],
    "preview_max_x": "1024",
    "preview_max_y": "768",
    "preview_max_scale_factor": "1",
    "auth.bruteforce.protection.enabled": "true",
    "trashbin_retention_obligation": "auto,7",
    "skeletondirectory": "",
    "defaultapp": "file",
    "activity_expire_days": "14",
    "integrity.check.disabled": "false",
    "updater.release.channel": "stable",
    "loglevel": 2,
    "maintenance": false,
    "theme": ""
}

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

Are you using encryption: false

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

Client configuration

Browser: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0

Operating system: Windows 10, Mac, and Ubuntu 18.04

Logs

Browser log
Insert your browser log here, this could for example include:

	a) The javascript console log
	b) The network log
	c) ...
Nextcloud log
octrine\DBAL\Exception\DriverException: 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 ["5", "13", 1541566026, 10000000, "c1ce0cebda9fbda9ef55d029fdb7bce6", 1541566026, 27, 3352905, "", "a5a1e8067e7403ebc501a7027729bb56", "uploads\/1505869900\/00000009", "00000009", 3, 3, "a5a1e8067e7403ebc501a7027729bb56"]: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128:

    Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException("An exceptio ... n", Doctrine\DBA ... ]})

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1015:

    Doctrine\DBAL\DBALException::driverExceptionDuringQuery(Doctrine\DBA ... {}, Doctrine\DBA ... ]}, "INSERT INTO ... 0", { 1: "5",2: ... "})

    /var/www/nextcloud/lib/private/DB/Connection.php - line 216:

    Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... 0", [ "5","13",1 ... "], [])

    /var/www/nextcloud/lib/private/DB/Adapter.php - line 114:

    OC\DB\Connection->executeUpdate("INSERT INTO ... 0", [ "5","13",1 ... "])

    /var/www/nextcloud/lib/private/DB/Connection.php - line 254:

    OC\DB\Adapter->insertIfNotExist("*PREFIX*filecache", { mimepart: ... 3}, [ "storage","path_hash"])

    /var/www/nextcloud/lib/private/Files/Cache/Cache.php - line 272:

    OC\DB\Connection->insertIfNotExist("*PREFIX*filecache", { mimepart: ... 3}, [ "storage","path_hash"])

    /var/www/nextcloud/apps/files_automatedtagging/lib/CacheWrapper.php - line 62:

    OC\Files\Cache\Cache->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 128:

    OCA\FilesAutomatedTagging\CacheWrapper->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 128:

    OC\Files\Cache\Wrapper\CacheWrapper->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 114:

    OC\Files\Cache\Wrapper\CacheWrapper->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Scanner.php - line 292:

    OC\Files\Cache\Wrapper\CacheWrapper->put("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Scanner.php - line 221:

    OC\Files\Cache\Scanner->addToCache("uploads/1505869900/00000009", { mimetype: ... "}, -1)

    /var/www/nextcloud/lib/private/Files/Cache/Scanner.php - line 336:

    OC\Files\Cache\Scanner->scanFile("uploads/1505869900/00000009", 3, 3352905, false, false)

    /var/www/nextcloud/lib/private/Files/Cache/Updater.php - line 124:

    OC\Files\Cache\Scanner->scan("uploads/1505869900/00000009", false, 3, false)

    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 235:

    OC\Files\Cache\Updater->update("uploads/1505869900/00000009")

    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 156:

    OCA\DAV\Connector\Sabre\File->put(null)

    /var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php - line 39:

    OCA\DAV\Connector\Sabre\Directory->createFile("00000009", null)

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096:

    OCA\DAV\Upload\UploadFolder->createFile("00000009", null)

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 529:

    Sabre\DAV\Server->createFile("uploads/dav ... 9", null, null)

    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

    /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:

    call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:

    Sabre\Event\EventEmitter->emit("method:PUT", [ Sabre\HTTP ... }])

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:

    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

    /var/www/nextcloud/apps/dav/lib/Server.php - line 293:

    Sabre\DAV\Server->exec()

    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

    OCA\DAV\Server->exec()

    /var/www/nextcloud/remote.php - line 163:

    require_once("/var/www/ne ... p")

Cased by Doctrine\DBAL\Driver\PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

    /var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 1008:

    Doctrine\DBAL\Driver\PDOStatement->execute([ "5","13",1 ... "])

    /var/www/nextcloud/lib/private/DB/Connection.php - line 216:

    Doctrine\DBAL\Connection->executeUpdate("INSERT INTO ... 0", [ "5","13",1 ... "], [])

    /var/www/nextcloud/lib/private/DB/Adapter.php - line 114:

    OC\DB\Connection->executeUpdate("INSERT INTO ... 0", [ "5","13",1 ... "])

    /var/www/nextcloud/lib/private/DB/Connection.php - line 254:

    OC\DB\Adapter->insertIfNotExist("*PREFIX*filecache", { mimepart: ... 3}, [ "storage","path_hash"])

    /var/www/nextcloud/lib/private/Files/Cache/Cache.php - line 272:

    OC\DB\Connection->insertIfNotExist("*PREFIX*filecache", { mimepart: ... 3}, [ "storage","path_hash"])

    /var/www/nextcloud/apps/files_automatedtagging/lib/CacheWrapper.php - line 62:

    OC\Files\Cache\Cache->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 128:

    OCA\FilesAutomatedTagging\CacheWrapper->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 128:

    OC\Files\Cache\Wrapper\CacheWrapper->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php - line 114:

    OC\Files\Cache\Wrapper\CacheWrapper->insert("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Scanner.php - line 292:

    OC\Files\Cache\Wrapper\CacheWrapper->put("uploads/1505869900/00000009", { mimetype: ... "})

    /var/www/nextcloud/lib/private/Files/Cache/Scanner.php - line 221:

    OC\Files\Cache\Scanner->addToCache("uploads/1505869900/00000009", { mimetype: ... "}, -1)

    /var/www/nextcloud/lib/private/Files/Cache/Scanner.php - line 336:

    OC\Files\Cache\Scanner->scanFile("uploads/1505869900/00000009", 3, 3352905, false, false)

    /var/www/nextcloud/lib/private/Files/Cache/Updater.php - line 124:

    OC\Files\Cache\Scanner->scan("uploads/1505869900/00000009", false, 3, false)

    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php - line 235:

    OC\Files\Cache\Updater->update("uploads/1505869900/00000009")

    /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 156:

    OCA\DAV\Connector\Sabre\File->put(null)

    /var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php - line 39:

    OCA\DAV\Connector\Sabre\Directory->createFile("00000009", null)

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1096:

    OCA\DAV\Upload\UploadFolder->createFile("00000009", null)

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 529:

    Sabre\DAV\Server->createFile("uploads/dav ... 9", null, null)

    Sabre\DAV\CorePlugin->httpPut(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

    /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:

    call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:

    Sabre\Event\EventEmitter->emit("method:PUT", [ Sabre\HTTP ... }])

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:

    Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})

    /var/www/nextcloud/apps/dav/lib/Server.php - line 293:

    Sabre\DAV\Server->exec()

    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

    OCA\DAV\Server->exec()

    /var/www/nextcloud/remote.php - line 163:

    require_once("/var/www/ne ... p")
Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

EDIT:

I initiated a rescan of the server and it's been stuck on the first user for like 30 minutes which seems long to me.

EDIT2: Scan finished but no change in the logs or in the accessibility of my server from outside the localhost. I have turned off my phone's folder sync jobs in case that was part of the cause.

@nextcloud-bot
Copy link
Member

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

@MorrisJobke
Copy link
Member

That looks like the linked tickets in #12315 - I guess I will look into this soon as commented in #12315 (comment)

@jcklpe
Copy link
Author

jcklpe commented Nov 9, 2018

@MorrisJobke Cool, thanks. Also after stopping the sync webdav services from my phone and rebooting my server is back up. I am guessing from that link that the issues has to do with my phone sending too many files over to my server and that creating some kind of concurrency problem for the database?

@MorrisJobke
Copy link
Member

@MorrisJobke Cool, thanks. Also after stopping the sync webdav services from my phone and rebooting my server is back up. I am guessing from that link that the issues has to do with my phone sending too many files over to my server and that creating some kind of concurrency problem for the database?

iOS or Android?

@MorrisJobke
Copy link
Member

octrine\DBAL\Exception\DriverException: 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 ["5", "13", 1541566026, 10000000, "c1ce0cebda9fbda9ef55d029fdb7bce6", 1541566026, 27, 3352905, "", "a5a1e8067e7403ebc501a7027729bb56", "uploads/1505869900/00000009", "00000009", 3, 3, "a5a1e8067e7403ebc501a7027729bb56"]: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction

Duplicate of #6160

@MorrisJobke
Copy link
Member

Overview ticket can be found at #12369

@jcklpe
Copy link
Author

jcklpe commented Nov 9, 2018

@MorrisJobke Android. I'm using the android app FolderSync and using a webdav connection. I'd prefer to use the official NextCloud app but the way auto upload works is a bit frustrating and cluttered.

@MorrisJobke
Copy link
Member

Generic fix is #12371 and the specific one for this one on top is #12411

@jcklpe
Copy link
Author

jcklpe commented Nov 12, 2018

@MorrisJobke Awesome, you rock!

Also from reading yall's stuff I understood the issue to be a concurrency issue probably so I adjusted my FolderSync settings to upload things at the time of saving them rather than on the hour, since if all the folders updated exactly on the hour, that was probably what was causing the concurrency issue on my end, I figured. Either way the cloud hasn't crashed yet.

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants