{"action":"created","issue":{"url":"https://api.github.com/repos/electron-userland/electron-json-storage/issues/80","repository_url":"https://api.github.com/repos/electron-userland/electron-json-storage","labels_url":"https://api.github.com/repos/electron-userland/electron-json-storage/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/electron-userland/electron-json-storage/issues/80/comments","events_url":"https://api.github.com/repos/electron-userland/electron-json-storage/issues/80/events","html_url":"https://github.com/electron-userland/electron-json-storage/issues/80","id":252125322,"number":80,"title":"Multi-instance read/write safety?","user":{"login":"randonia","id":483267,"avatar_url":"https://avatars2.githubusercontent.com/u/483267?v=4","gravatar_id":"","url":"https://api.github.com/users/randonia","html_url":"https://github.com/randonia","followers_url":"https://api.github.com/users/randonia/followers","following_url":"https://api.github.com/users/randonia/following{/other_user}","gists_url":"https://api.github.com/users/randonia/gists{/gist_id}","starred_url":"https://api.github.com/users/randonia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randonia/subscriptions","organizations_url":"https://api.github.com/users/randonia/orgs","repos_url":"https://api.github.com/users/randonia/repos","events_url":"https://api.github.com/users/randonia/events{/privacy}","received_events_url":"https://api.github.com/users/randonia/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-23T00:23:22Z","updated_at":"2017-08-24T16:50:26Z","closed_at":"2017-08-24T16:50:26Z","body":"I have occasionally run into an issue where my data will be corrupted in a way that appears to be due non-locked multi-process writes.\r\n\r\nFor example, the file will result like this:\r\n\r\n`{\"foo\": false,\"bar\": 42,\"baz\":12345}az\":12345}`\r\nThis usually happens when it seems like two or more separate electron render processes are writing different values to the same location.\r\n\r\nIs there an way to guarantee mutex locking or a different access/write pattern that I should follow? Right now almost all of my reads/writes are using [Electron's remote object API](https://github.com/electron/electron/blob/master/docs/api/remote.md#remotegetglobalname), so theoretically they're using the same object instance to read/write.\r\n\r\nThanks!\r\n\r\n[edit] I found a few places in our code where we weren't using the same instance object and therefore I'm assuming that was responsible for the [existing lock protection](https://github.com/electron-userland/electron-json-storage/blob/master/lib/storage.js#L198) not correctly working. I'll close the issue when I can verify resolution, but would like to leave this issue up in case anyone else stumbles upon this error googling problems."},"comment":{"url":"https://api.github.com/repos/electron-userland/electron-json-storage/issues/comments/324692802","html_url":"https://github.com/electron-userland/electron-json-storage/issues/80#issuecomment-324692802","issue_url":"https://api.github.com/repos/electron-userland/electron-json-storage/issues/80","id":324692802,"user":{"login":"randonia","id":483267,"avatar_url":"https://avatars2.githubusercontent.com/u/483267?v=4","gravatar_id":"","url":"https://api.github.com/users/randonia","html_url":"https://github.com/randonia","followers_url":"https://api.github.com/users/randonia/followers","following_url":"https://api.github.com/users/randonia/following{/other_user}","gists_url":"https://api.github.com/users/randonia/gists{/gist_id}","starred_url":"https://api.github.com/users/randonia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randonia/subscriptions","organizations_url":"https://api.github.com/users/randonia/orgs","repos_url":"https://api.github.com/users/randonia/repos","events_url":"https://api.github.com/users/randonia/events{/privacy}","received_events_url":"https://api.github.com/users/randonia/received_events","type":"User","site_admin":false},"created_at":"2017-08-24T16:50:25Z","updated_at":"2017-08-24T16:50:25Z","body":"Turns out this was fixed by #72 . We were using `3.0.5` :) Thanks for being a rubber :duck: "}}
{"actor":{"display_login":"randonia"}}