{"action":"created","issue":{"url":"https://api.github.com/repos/boltdb/bolt/issues/392","labels_url":"https://api.github.com/repos/boltdb/bolt/issues/392/labels{/name}","comments_url":"https://api.github.com/repos/boltdb/bolt/issues/392/comments","events_url":"https://api.github.com/repos/boltdb/bolt/issues/392/events","html_url":"https://github.com/boltdb/bolt/issues/392","id":88177476,"number":392,"title":"Clarify transaction concurrency","user":{"login":"calmh","id":125426,"avatar_url":"https://avatars.githubusercontent.com/u/125426?v=3","gravatar_id":"","url":"https://api.github.com/users/calmh","html_url":"https://github.com/calmh","followers_url":"https://api.github.com/users/calmh/followers","following_url":"https://api.github.com/users/calmh/following{/other_user}","gists_url":"https://api.github.com/users/calmh/gists{/gist_id}","starred_url":"https://api.github.com/users/calmh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calmh/subscriptions","organizations_url":"https://api.github.com/users/calmh/orgs","repos_url":"https://api.github.com/users/calmh/repos","events_url":"https://api.github.com/users/calmh/events{/privacy}","received_events_url":"https://api.github.com/users/calmh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-14T12:29:18Z","updated_at":"2015-06-14T15:16:51Z","closed_at":null,"body":"The readme says:\r\n\r\n> Read-only transactions and read-write transactions should not depend on one another and generally shouldn't be opened simultaneously in the same goroutine. This can cause a deadlock as the read-write transaction needs to periodically re-map the data file but it cannot do so while a read-only transaction is open.\r\n\r\nHowever it seems transactions are protected by an RWMutex. That means it's impossible to open a write transaction (from any goroutine) while there is a read transaction still open and vice versa; also opening new read transactions is blocked while a write transaction is waiting to begin. Am I misunderstanding how this works?"},"comment":{"url":"https://api.github.com/repos/boltdb/bolt/issues/comments/111840746","html_url":"https://github.com/boltdb/bolt/issues/392#issuecomment-111840746","issue_url":"https://api.github.com/repos/boltdb/bolt/issues/392","id":111840746,"user":{"login":"MJDSys","id":2875429,"avatar_url":"https://avatars.githubusercontent.com/u/2875429?v=3","gravatar_id":"","url":"https://api.github.com/users/MJDSys","html_url":"https://github.com/MJDSys","followers_url":"https://api.github.com/users/MJDSys/followers","following_url":"https://api.github.com/users/MJDSys/following{/other_user}","gists_url":"https://api.github.com/users/MJDSys/gists{/gist_id}","starred_url":"https://api.github.com/users/MJDSys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MJDSys/subscriptions","organizations_url":"https://api.github.com/users/MJDSys/orgs","repos_url":"https://api.github.com/users/MJDSys/repos","events_url":"https://api.github.com/users/MJDSys/events{/privacy}","received_events_url":"https://api.github.com/users/MJDSys/received_events","type":"User","site_admin":false},"created_at":"2015-06-14T15:16:51Z","updated_at":"2015-06-14T15:16:51Z","body":"From what I saw of the discussions about this, there is no locking between read and write transactions, as long as the database file doesn't need to grow.  Taking a quick glance at the code, this appears to be the case as the write transactions don't pick up any exclusive locks that the read transactions do.\r\n\r\nThere is a Mutex (not a RWMutex!) called rwlock, but that is only taken in the write path."}}