{"action":"opened","issue":{"url":"https://api.github.com/repos/mchidk/BinaryRage/issues/33","repository_url":"https://api.github.com/repos/mchidk/BinaryRage","labels_url":"https://api.github.com/repos/mchidk/BinaryRage/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/mchidk/BinaryRage/issues/33/comments","events_url":"https://api.github.com/repos/mchidk/BinaryRage/issues/33/events","html_url":"https://github.com/mchidk/BinaryRage/issues/33","id":135274943,"number":33,"title":"Racecondtion if you use different file locations and value types","user":{"login":"ElLeopard","id":11961284,"avatar_url":"https://avatars.githubusercontent.com/u/11961284?v=3","gravatar_id":"","url":"https://api.github.com/users/ElLeopard","html_url":"https://github.com/ElLeopard","followers_url":"https://api.github.com/users/ElLeopard/followers","following_url":"https://api.github.com/users/ElLeopard/following{/other_user}","gists_url":"https://api.github.com/users/ElLeopard/gists{/gist_id}","starred_url":"https://api.github.com/users/ElLeopard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ElLeopard/subscriptions","organizations_url":"https://api.github.com/users/ElLeopard/orgs","repos_url":"https://api.github.com/users/ElLeopard/repos","events_url":"https://api.github.com/users/ElLeopard/events{/privacy}","received_events_url":"https://api.github.com/users/ElLeopard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-21T23:22:03Z","updated_at":"2016-02-21T23:22:03Z","closed_at":null,"body":"Hi,\r\nfirst of all, thanks for a nice piece of code.\r\n\r\nUnfortunately, I discovered a race condition issue:\r\nI used the BinaryRage for two different file locations and value types, but after a while I ended up with a SerializationException when doing a DB.Get. This was during heavy concurrency between the different DB calls.\r\n\r\nThe culprit seems to be in DB.Insert:\r\nThe \"sendQueue\" is static and shared among all Inserts.\r\nThe \"add\" and the \"take\" can act on objects with different file location and value types.\r\nAfter removing the sendQueue, and using \"simpleObject\" instead of \"data\", I was unable to reproduce the bug.\r\nThe ObjectToByteArray acts on \"value\" and not on \"data.Value\" which could be two widely different types."}}