{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/20226","labels_url":"https://api.github.com/repos/owncloud/core/issues/20226/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/20226/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/20226/events","html_url":"https://github.com/owncloud/core/issues/20226","id":114603709,"number":20226,"title":"Deadlock detected by pdo and cron fails with uncaught exception","user":{"login":"gig13","id":4803385,"avatar_url":"https://avatars.githubusercontent.com/u/4803385?v=3","gravatar_id":"","url":"https://api.github.com/users/gig13","html_url":"https://github.com/gig13","followers_url":"https://api.github.com/users/gig13/followers","following_url":"https://api.github.com/users/gig13/following{/other_user}","gists_url":"https://api.github.com/users/gig13/gists{/gist_id}","starred_url":"https://api.github.com/users/gig13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gig13/subscriptions","organizations_url":"https://api.github.com/users/gig13/orgs","repos_url":"https://api.github.com/users/gig13/repos","events_url":"https://api.github.com/users/gig13/events{/privacy}","received_events_url":"https://api.github.com/users/gig13/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/owncloud/core/labels/blue-ticket","name":"blue-ticket","color":"0033CC"},{"url":"https://api.github.com/repos/owncloud/core/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-11-02T14:24:43Z","updated_at":"2015-11-12T13:59:06Z","closed_at":null,"body":"### Steps to reproduce\r\n1. Trying to reproduce\r\n\r\n### Expected behaviour\r\nThere should not be any deadlock detected by pdo. The cron should also not fail due to an uncaught exception (caused by this deadlock in this case)\r\n\r\n### Actual behaviour\r\nWe had the cron job report this today. It seems that there is a deadlock reported by pdo when trying to perform a query. We have a galera cluster behind an haproxy load balancer. So queries go to all three nodes. It appears that a query on one node had a lock when the cron job wanted it.\r\n\r\n### Server configuration\r\n**Operating system**: RHEL\r\n\r\n**Web server:** Apache\r\n\r\n**Database:** Galera cluster\r\n\r\n**Load Balancer:** HAProxy - queries go through all nodes\r\n\r\n**PHP version:** 5.5.29\r\n\r\n**ownCloud version:** 8.1.3\r\n\r\n**Updated from an older ownCloud or fresh install:**  Updated\r\n\r\n**Are you using encryption:** NO\r\n\r\n**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory\r\n\r\n### Logs\r\n#### ownCloud log (data/owncloud.log)\r\n```\r\nPHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction' in /var/www/html/owncloud-enterprise/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91\r\nStack trace:\r\n#0 /var/www/html/owncloud-enterprise/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(91): PDOStatement->execute(Array)\r\n#1 /var/www/html/owncloud-enterprise/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Statement.php(165): Doctrine\\DBAL\\Driver\\PDOStatement->execute(Array)\r\n#2 /var/www/html/owncloud-enterprise/lib/private/db/statementwrapper.php(73): Doctrine\\DBAL\\Statement->execute(Array)\r\n#3 /var/www/html/owncloud-enterprise/lib/private/db.php(147): OC_DB_StatementWrapper->execute(Array)\r\n#4 /var/www/html/owncloud-enterprise/lib/private/files/cache/cache.php(364): OC_DB::executeAudited('UPDATE `*PREFIX...', Array)\r\n#5 /var/www/html/owncloud-enterprise/lib/private/files/cache/changepropagator.php(79): OC\\Files\\Cache\\Cache->updat in /var/www/html/owncloud-enterprise/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 115\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/156108792","html_url":"https://github.com/owncloud/core/issues/20226#issuecomment-156108792","issue_url":"https://api.github.com/repos/owncloud/core/issues/20226","id":156108792,"user":{"login":"gig13","id":4803385,"avatar_url":"https://avatars.githubusercontent.com/u/4803385?v=3","gravatar_id":"","url":"https://api.github.com/users/gig13","html_url":"https://github.com/gig13","followers_url":"https://api.github.com/users/gig13/followers","following_url":"https://api.github.com/users/gig13/following{/other_user}","gists_url":"https://api.github.com/users/gig13/gists{/gist_id}","starred_url":"https://api.github.com/users/gig13/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gig13/subscriptions","organizations_url":"https://api.github.com/users/gig13/orgs","repos_url":"https://api.github.com/users/gig13/repos","events_url":"https://api.github.com/users/gig13/events{/privacy}","received_events_url":"https://api.github.com/users/gig13/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T13:59:06Z","updated_at":"2015-11-12T13:59:06Z","body":"@MorrisJobke @icewind1991 @bboule \r\nIs this targeted for any release? Do you need additional information?\r\n\r\nThe cron is run on each web server. One server is scheduled for 00 and 30 minutes past the hour and the other is 15 and 45. We've specified in config.php for the path for the cron lock file to be in our data directory. That's shared between both servers by smb so one can see if the other has a cron job still running (eg long running activity clean up or something). Our smb share does support locking and I've tested to confirm that cron will only run one at at time. So it's not a case of two cron jobs causing the deadlock."}}