{"action":"created","issue":{"url":"https://api.github.com/repos/owncloud/core/issues/14329","labels_url":"https://api.github.com/repos/owncloud/core/issues/14329/labels{/name}","comments_url":"https://api.github.com/repos/owncloud/core/issues/14329/comments","events_url":"https://api.github.com/repos/owncloud/core/issues/14329/events","html_url":"https://github.com/owncloud/core/pull/14329","id":58064702,"number":14329,"title":"Add some closeCursor functions to file cache to avoid database locks.","user":{"login":"dragotin","id":1070214,"avatar_url":"https://avatars.githubusercontent.com/u/1070214?v=3","gravatar_id":"","url":"https://api.github.com/users/dragotin","html_url":"https://github.com/dragotin","followers_url":"https://api.github.com/users/dragotin/followers","following_url":"https://api.github.com/users/dragotin/following{/other_user}","gists_url":"https://api.github.com/users/dragotin/gists{/gist_id}","starred_url":"https://api.github.com/users/dragotin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dragotin/subscriptions","organizations_url":"https://api.github.com/users/dragotin/orgs","repos_url":"https://api.github.com/users/dragotin/repos","events_url":"https://api.github.com/users/dragotin/events{/privacy}","received_events_url":"https://api.github.com/users/dragotin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/31","labels_url":"https://api.github.com/repos/owncloud/core/milestones/31/labels","id":912160,"number":31,"title":"8.1-next","description":"","creator":{"login":"MorrisJobke","id":245432,"avatar_url":"https://avatars.githubusercontent.com/u/245432?v=3","gravatar_id":"","url":"https://api.github.com/users/MorrisJobke","html_url":"https://github.com/MorrisJobke","followers_url":"https://api.github.com/users/MorrisJobke/followers","following_url":"https://api.github.com/users/MorrisJobke/following{/other_user}","gists_url":"https://api.github.com/users/MorrisJobke/gists{/gist_id}","starred_url":"https://api.github.com/users/MorrisJobke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MorrisJobke/subscriptions","organizations_url":"https://api.github.com/users/MorrisJobke/orgs","repos_url":"https://api.github.com/users/MorrisJobke/repos","events_url":"https://api.github.com/users/MorrisJobke/events{/privacy}","received_events_url":"https://api.github.com/users/MorrisJobke/received_events","type":"User","site_admin":false},"open_issues":368,"closed_issues":111,"state":"open","created_at":"2014-12-22T12:04:01Z","updated_at":"2015-02-18T13:58:48Z","due_on":"2015-04-02T22:00:00Z","closed_at":null},"comments":8,"created_at":"2015-02-18T13:01:00Z","updated_at":"2015-02-18T14:20:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/14329","html_url":"https://github.com/owncloud/core/pull/14329","diff_url":"https://github.com/owncloud/core/pull/14329.diff","patch_url":"https://github.com/owncloud/core/pull/14329.patch"},"body":"I'd recommend to add the call to **closeCursor()** on *every* sql statement object that is not longer used. I took some time to dig through the sources of doctrine and pdo and the sqlite implementation in particular and it turns out that the sqlite3_finalize() function, that frees the database statement, is only called in the destructor (for the C++ implementation). I don't know *when* that is called by the PHP engine, but obviously that can be done any time later. \r\n\r\nAs especially SQLite has a very interesting locking method it can easily happen that a writing operation on a table (INSERT, UPDATE) keeps an lock also for reads as long as the writing operation statement was not closed. The subsequent read operations easily can time out or see a lock because of that.\r\n\r\nApart from that, I think it would be good to set a busy handler timeout explicitely:\r\n<code type=\"php\">\r\n$PDO->setAttribute( PDO::ATTR_TIMEOUT, 5 /* Timeout in seconds */ );\r\n</code>\r\nbut I am not sure where to set that.\r\n\r\nThis submit request is just one step, I think the closeCursor() functions should be added wherever database interaction happens.\r\n\r\nNote: This is **not** a SQLite only problem, it's just pretty visible there."},"comment":{"url":"https://api.github.com/repos/owncloud/core/issues/comments/74870525","html_url":"https://github.com/owncloud/core/pull/14329#issuecomment-74870525","issue_url":"https://api.github.com/repos/owncloud/core/issues/14329","id":74870525,"user":{"login":"scrutinizer-notifier","id":6398257,"avatar_url":"https://avatars.githubusercontent.com/u/6398257?v=3","gravatar_id":"","url":"https://api.github.com/users/scrutinizer-notifier","html_url":"https://github.com/scrutinizer-notifier","followers_url":"https://api.github.com/users/scrutinizer-notifier/followers","following_url":"https://api.github.com/users/scrutinizer-notifier/following{/other_user}","gists_url":"https://api.github.com/users/scrutinizer-notifier/gists{/gist_id}","starred_url":"https://api.github.com/users/scrutinizer-notifier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrutinizer-notifier/subscriptions","organizations_url":"https://api.github.com/users/scrutinizer-notifier/orgs","repos_url":"https://api.github.com/users/scrutinizer-notifier/repos","events_url":"https://api.github.com/users/scrutinizer-notifier/events{/privacy}","received_events_url":"https://api.github.com/users/scrutinizer-notifier/received_events","type":"User","site_admin":false},"created_at":"2015-02-18T14:20:23Z","updated_at":"2015-02-18T14:20:23Z","body":"A [new inspection](https://scrutinizer-ci.com/g/owncloud/core/inspections/0b127405-f336-4154-aa97-cfc31e348075) was created."}}