{"action":"created","issue":{"url":"https://api.github.com/repos/commonsguy/cwac-saferoom/issues/50","repository_url":"https://api.github.com/repos/commonsguy/cwac-saferoom","labels_url":"https://api.github.com/repos/commonsguy/cwac-saferoom/issues/50/labels{/name}","comments_url":"https://api.github.com/repos/commonsguy/cwac-saferoom/issues/50/comments","events_url":"https://api.github.com/repos/commonsguy/cwac-saferoom/issues/50/events","html_url":"https://github.com/commonsguy/cwac-saferoom/issues/50","id":433674387,"node_id":"MDU6SXNzdWU0MzM2NzQzODc=","number":50,"title":"Deadlock SQLiteDatabase/Helper","user":{"login":"CreepyMob","id":16867986,"node_id":"MDQ6VXNlcjE2ODY3OTg2","avatar_url":"https://avatars1.githubusercontent.com/u/16867986?v=4","gravatar_id":"","url":"https://api.github.com/users/CreepyMob","html_url":"https://github.com/CreepyMob","followers_url":"https://api.github.com/users/CreepyMob/followers","following_url":"https://api.github.com/users/CreepyMob/following{/other_user}","gists_url":"https://api.github.com/users/CreepyMob/gists{/gist_id}","starred_url":"https://api.github.com/users/CreepyMob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CreepyMob/subscriptions","organizations_url":"https://api.github.com/users/CreepyMob/orgs","repos_url":"https://api.github.com/users/CreepyMob/repos","events_url":"https://api.github.com/users/CreepyMob/events{/privacy}","received_events_url":"https://api.github.com/users/CreepyMob/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-04-16T09:25:50Z","updated_at":"2019-04-16T09:41:40Z","closed_at":null,"author_association":"NONE","body":"Reached deadlock when start transaction from first thread and close db from second.\r\nIf first thread calls `beginTransaction`, SQLiteDatabase invokes `lock` on internal lock object and if at the next point in time second thread calls `close` which hold monitor of Helper.class because `Helper::close` synchronized, `Helper::close` under the hood calls `SQLiteDatabase::close` and also locks on internal SQLiteDatabase lock object because transaction also doesn't end. But in the same time transaction now cannot be ended because for end of transaction we need to call `Helper::getWritableDatabase::endTransaction` which locks on Helper monitor because second thread doesn't end close and also hold Helper monitor.\r\n\r\nAlso if you just remove synchronization from Helper/OpenHelper(delegate) deadlock still can be reached, because OpenHelper extends from  net.sqlcipher.database.SQLiteOpenHelper which also synchronized on the same method and OpenHelper call them as super  "},"comment":{"url":"https://api.github.com/repos/commonsguy/cwac-saferoom/issues/comments/483588398","html_url":"https://github.com/commonsguy/cwac-saferoom/issues/50#issuecomment-483588398","issue_url":"https://api.github.com/repos/commonsguy/cwac-saferoom/issues/50","id":483588398,"node_id":"MDEyOklzc3VlQ29tbWVudDQ4MzU4ODM5OA==","user":{"login":"CreepyMob","id":16867986,"node_id":"MDQ6VXNlcjE2ODY3OTg2","avatar_url":"https://avatars1.githubusercontent.com/u/16867986?v=4","gravatar_id":"","url":"https://api.github.com/users/CreepyMob","html_url":"https://github.com/CreepyMob","followers_url":"https://api.github.com/users/CreepyMob/followers","following_url":"https://api.github.com/users/CreepyMob/following{/other_user}","gists_url":"https://api.github.com/users/CreepyMob/gists{/gist_id}","starred_url":"https://api.github.com/users/CreepyMob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CreepyMob/subscriptions","organizations_url":"https://api.github.com/users/CreepyMob/orgs","repos_url":"https://api.github.com/users/CreepyMob/repos","events_url":"https://api.github.com/users/CreepyMob/events{/privacy}","received_events_url":"https://api.github.com/users/CreepyMob/received_events","type":"User","site_admin":false},"created_at":"2019-04-16T09:41:40Z","updated_at":"2019-04-16T09:41:40Z","author_association":"NONE","body":"https://github.com/sqlcipher/android-database-sqlcipher/issues/437"}}
{"actor":{"display_login":"CreepyMob"}}