{"action":"created","issue":{"url":"https://api.github.com/repos/lunixbochs/struc/issues/32","labels_url":"https://api.github.com/repos/lunixbochs/struc/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/lunixbochs/struc/issues/32/comments","events_url":"https://api.github.com/repos/lunixbochs/struc/issues/32/events","html_url":"https://github.com/lunixbochs/struc/issues/32","id":123096045,"number":32,"title":"Race condition in initial struct field parsing","user":{"login":"quantum1423","id":681609,"avatar_url":"https://avatars.githubusercontent.com/u/681609?v=3","gravatar_id":"","url":"https://api.github.com/users/quantum1423","html_url":"https://github.com/quantum1423","followers_url":"https://api.github.com/users/quantum1423/followers","following_url":"https://api.github.com/users/quantum1423/following{/other_user}","gists_url":"https://api.github.com/users/quantum1423/gists{/gist_id}","starred_url":"https://api.github.com/users/quantum1423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantum1423/subscriptions","organizations_url":"https://api.github.com/users/quantum1423/orgs","repos_url":"https://api.github.com/users/quantum1423/repos","events_url":"https://api.github.com/users/quantum1423/events{/privacy}","received_events_url":"https://api.github.com/users/quantum1423/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-12-19T16:27:37Z","updated_at":"2015-12-19T21:32:41Z","closed_at":"2015-12-19T21:32:41Z","body":"The go race detector complains about the initial struct field parsing if two goroutines start packing or unpacking a struct simultaneously before the struct fields are properly parsed. This is usually not an issue, and I've worked around by putting a dummy pack and unpack in `init()`, but it can be annoying. It's a real race condition: I've had a few extremely rare (as in, once every few hundred runs of all my tests) and difficult-to-reproduce errors (unpacked struct containing garbage) due to this race condition. Now, the garbage occurs only once, but it's still an annoying bug with major security implications (since it violates memory safety).\r\n\r\nI would imagine this to be easily fixed by adding a global lock around the struct field parsing."},"comment":{"url":"https://api.github.com/repos/lunixbochs/struc/issues/comments/166027965","html_url":"https://github.com/lunixbochs/struc/issues/32#issuecomment-166027965","issue_url":"https://api.github.com/repos/lunixbochs/struc/issues/32","id":166027965,"user":{"login":"quantum1423","id":681609,"avatar_url":"https://avatars.githubusercontent.com/u/681609?v=3","gravatar_id":"","url":"https://api.github.com/users/quantum1423","html_url":"https://github.com/quantum1423","followers_url":"https://api.github.com/users/quantum1423/followers","following_url":"https://api.github.com/users/quantum1423/following{/other_user}","gists_url":"https://api.github.com/users/quantum1423/gists{/gist_id}","starred_url":"https://api.github.com/users/quantum1423/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quantum1423/subscriptions","organizations_url":"https://api.github.com/users/quantum1423/orgs","repos_url":"https://api.github.com/users/quantum1423/repos","events_url":"https://api.github.com/users/quantum1423/events{/privacy}","received_events_url":"https://api.github.com/users/quantum1423/received_events","type":"User","site_admin":false},"created_at":"2015-12-19T21:32:41Z","updated_at":"2015-12-19T21:32:41Z","body":"Ah yes. Sorry for overlooking it. I'm going to close this issue."}}