owncloud / owncloud/core

Deadlocks detected on DBLockingProvider.php after update to 10.5

Open
#38,221 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type:Bug
Dominant language
PHP
Stars
8.8k
Forks
2.1k
Avg merge
20h 7m
Merged PRs (30d)
41

Description

Steps to reproduce
  1. Seems to happen randomly
Expected behaviour

No Deadlocks detected, like with previous versions.

Actual behaviour

We've been maintaining an Owncloud installation and upgrading to each version since v9 without problems. We were running 10.2 for a while flawlessly but as soon as we upgraded to 10.5 we are getting deadlocks errors reported in the apache error_log file:

[Mon Dec 14 08:33:58.148407 2020] [php7:error] [pid 87941] [client 10.226.250.13:58662] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:127
Stack trace:
#0 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(127): PDOStatement->execute(NULL)
#1 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1062): Doctrine\\DBAL\\Driver\\PDOStatement->execute()
#2 /var/www/html/owncloud/lib/private/DB/Connection.php(207): Doctrine\\DBAL\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)
#3 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(209): OC\\DB\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)
#4 /var/www/html/owncloud/lib/private/DB/QueryBuilder/QueryBuilder.php(141): Doctrine\\DBAL\\Query\\QueryBuilder->execute()
#5 /var/www/html/owncloud/lib/private/Lock/DBLockingProvider.php(281): OC\\DB\\QueryB in /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 34
Server configuration

Operating system: RHEL 7

Web server: Apache 2.4

Database: MySQL 5.7

PHP version: 7.2

ownCloud version: 10.5

Updated from an older ownCloud or fresh install: Updated from 10.2

Where did you install ownCloud from: .tar.gz package, manual install

Signing status (ownCloud 9.0 and above):

https://gist.github.com/mojontwins/6dac4d5b61b73ea7eba6d39d1d54a9a1

The content of config/config.php:

{
    "system": {
        "updatechecker": false,
        "instanceid": "ocd0oa4vyocy",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "10.240.243.167"
        ],
        "datadirectory": "\/cloud",
        "overwrite.cli.url": "http:\/\/10.240.243.167",
        "dbtype": "mysql",
        "version": "10.5.0.10",
        "dbname": "owncloud",
        "dbhost": "10.240.243.178",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "ldapIgnoreNamingRules": false,
        "theme": "",
        "log_type": "owncloud",
        "logfile": "\/var\/log\/owncloud.log",
        "logdateformat": "F d, Y H:i:s",
        "default_language": "es",
        "loglevel": 1,
        "maintenance": false,
        "htaccess.RewriteBase": "\/",
        "token_auth_enforced": false,
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/owncloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/owncloud\/apps-external",
                "url": "\/apps-external",
                "writable": true
            }
        ],
        "enable_avatars": true,
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": 25,
        "session_lifetime": 1800,
        "session_keepalive": false
    }
}

List of activated apps:

Enabled:
  - brute_force_protection: 1.0.1
  - comments: 0.3.0
  - configreport: 0.2.0
  - dav: 0.6.0
  - federatedfilesharing: 0.5.0
  - files: 1.5.2
  - files_external: 0.7.1
  - files_mediaviewer: 1.0.3
  - files_pdfviewer: 0.11.2
  - files_sharing: 0.13.0
  - files_texteditor: 2.3.0
  - files_trashbin: 0.9.1
  - files_versions: 1.3.0
  - files_videoplayer: 0.10.1
  - firstrunwizard: 1.2.0
  - market: 0.5.0
  - notifications: 0.5.2
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - theme-jda: 1.0.0
  - updatenotification: 0.2.1
  - user_ldap: 0.15.2
  - user_saml: 0.4.0
Disabled:
  - activity
  - admin_audit
  - announcementcenter
  - customgroups
  - encryption
  - enterprise_key
  - external
  - federation
  - files_antivirus
  - files_classifier
  - files_external_dropbox
  - files_external_ftp
  - files_ldap_home
  - firewall
  - guests
  - oauth2
  - password_policy
  - ransomware_protection
  - sharepoint
  - systemtags_management
  - templateeditor
  - theme-enterprise
  - twofactor_totp
  - user_external
  - user_shibboleth
  - windows_network_drive
  - wopi
  - workflow

Are you using external storage, if yes which one: nfs.

Are you using encryption: no

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

LDAP configuration (delete this part if not used)
+-------------------------------+----------------------------------------------------------------------------------+
| Configuration                 | s01                                                                              |
+-------------------------------+----------------------------------------------------------------------------------+
| hasMemberOfFilterSupport      | 0                                                                                |
| hasPagedResultSupport         |                                                                                  |
| homeFolderNamingRule          | attr:uid                                                                         |
| lastJpegPhotoLookup           | 0                                                                                |
| ldapAgentName                 |                                                                                  |
| ldapAgentPassword             | ***                                                                              |
| ldapAttributesForGroupSearch  |                                                                                  |
| ldapAttributesForUserSearch   | uid;cn                                                                           |
| ldapBackupHost                |                                                                                  |
| ldapBackupPort                |                                                                                  |
| ldapBase                      | o=empleados,o=juntadeandalucia,c=es                                              |
| ldapBaseGroups                | o=empleados,o=juntadeandalucia,c=es                                              |
| ldapBaseUsers                 | o=empleados,o=juntadeandalucia,c=es                                              |
| ldapCacheTTL                  | 600                                                                              |
| ldapConfigurationActive       | 1                                                                                |
| ldapDynamicGroupMemberURL     |                                                                                  |
| ldapEmailAttribute            | mail                                                                             |
| ldapExperiencedAdmin          | 1                                                                                |
| ldapExpertUUIDGroupAttr       |                                                                                  |
| ldapExpertUUIDUserAttr        | uid                                                                              |
| ldapExpertUsernameAttr        | uid                                                                              |
| ldapGroupDisplayName          | cn                                                                               |
| ldapGroupFilter               |                                                                                  |
| ldapGroupFilterGroups         |                                                                                  |
| ldapGroupFilterMode           | 0                                                                                |
| ldapGroupFilterObjectclass    |                                                                                  |
| ldapGroupMemberAssocAttr      | uniqueMember                                                                     |
| ldapHost                      | ldap23.juntadeandalucia.es                                                       |
| ldapIgnoreNamingRules         |                                                                                  |
| ldapLoginFilter               | (&(objectclass=empleado)(|(uid=%uid)(mail=%uid))(JAcloud=SI)(!(passCaducado=1))) |
| ldapLoginFilterAttributes     |                                                                                  |
| ldapLoginFilterEmail          | 0                                                                                |
| ldapLoginFilterMode           | 0                                                                                |
| ldapLoginFilterUsername       | 1                                                                                |
| ldapNestedGroups              | 0                                                                                |
| ldapNetworkTimeout            | 2                                                                                |
| ldapOverrideMainServer        |                                                                                  |
| ldapPagingSize                | 500                                                                              |
| ldapPort                      | 389                                                                              |
| ldapQuotaAttribute            | JAcloudQuota                                                                     |
| ldapQuotaDefault              |                                                                                  |
| ldapTLS                       | 0                                                                                |
| ldapUserDisplayName           | cn                                                                               |
| ldapUserDisplayName2          |                                                                                  |
| ldapUserFilter                | (&(objectclass=empleado)(JAcloud=SI)(!(passCaducado=1)))                         |
| ldapUserFilterGroups          |                                                                                  |
| ldapUserFilterMode            | 0                                                                                |
| ldapUserFilterObjectclass     | inetOrgPerson                                                                    |
| ldapUserName                  | samaccountname                                                                   |
| ldapUuidGroupAttribute        | auto                                                                             |
| ldapUuidUserAttribute         | auto                                                                             |
| turnOffCertCheck              | 0                                                                                |
| useMemberOfToDetectMembership | 1                                                                                |
+-------------------------------+----------------------------------------------------------------------------------+

Client configuration

Browser: N/A

Operating system: N/A

Logs
Web server error log
[Mon Dec 14 08:33:58.148407 2020] [php7:error] [pid 87941] [client 10.226.250.13:58662] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:127\nStack trace:\n#0 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(127): PDOStatement->execute(NULL)\n#1 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1062): Doctrine\\DBAL\\Driver\\PDOStatement->execute()\n#2 /var/www/html/owncloud/lib/private/DB/Connection.php(207): Doctrine\\DBAL\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#3 /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(209): OC\\DB\\Connection->executeUpdate('UPDATE `oc_file...', Array, Array)\n#4 /var/www/html/owncloud/lib/private/DB/QueryBuilder/QueryBuilder.php(141): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/html/owncloud/lib/private/Lock/DBLockingProvider.php(281): OC\\DB\\QueryB in /var/www/html/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 34
ownCloud log (data/owncloud.log)
Nothing about this issue in owncloud.log
Browser log
N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/private/Lock/DBLockingProvider.php around line 281 and inspect the UPDATE reported in the stack trace. Reproduce the issue on ownCloud 10.5 with MySQL 5.7, comparing behavior with 10.2. Done means identifying the locking regression and preventing the reported deadlock errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.