{"action":"created","issue":{"url":"https://api.github.com/repos/status-im/status-go/issues/709","repository_url":"https://api.github.com/repos/status-im/status-go","labels_url":"https://api.github.com/repos/status-im/status-go/issues/709/labels{/name}","comments_url":"https://api.github.com/repos/status-im/status-go/issues/709/comments","events_url":"https://api.github.com/repos/status-im/status-go/issues/709/events","html_url":"https://github.com/status-im/status-go/issues/709","id":300636580,"number":709,"title":"A data race while closing a node","user":{"login":"JekaMas","id":3192700,"avatar_url":"https://avatars0.githubusercontent.com/u/3192700?v=4","gravatar_id":"","url":"https://api.github.com/users/JekaMas","html_url":"https://github.com/JekaMas","followers_url":"https://api.github.com/users/JekaMas/followers","following_url":"https://api.github.com/users/JekaMas/following{/other_user}","gists_url":"https://api.github.com/users/JekaMas/gists{/gist_id}","starred_url":"https://api.github.com/users/JekaMas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JekaMas/subscriptions","organizations_url":"https://api.github.com/users/JekaMas/orgs","repos_url":"https://api.github.com/users/JekaMas/repos","events_url":"https://api.github.com/users/JekaMas/events{/privacy}","received_events_url":"https://api.github.com/users/JekaMas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-27T13:48:01Z","updated_at":"2018-02-27T15:35:21Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"# Problem\r\n\r\nWe have a data race while stopping the node.\r\n[data_race.txt](https://github.com/status-im/status-go/files/1763068/data_race.txt)\r\nThe patch with data race https://github.com/status-im/status-go/blob/develop/_assets/patches/geth/0016-fix-leveldb-issue.patch\r\n\r\n# Implementation\r\n\r\nThe cause is in code (`github.com/ethereum/go-ethereum/les/handler.go` after all patches):\r\n```go\r\nfor {\r\n        select {\r\n        case event := <-sub.Chan():\r\n            if event == nil {\r\n                return\r\n            }\r\n\r\n            switch event.Data.(type) {\r\n            case downloader.StartEvent:\r\n                pm.downloads.Add(1)\r\n            case downloader.DoneEvent, downloader.FailedEvent:\r\n                pm.downloads.Done()\r\n            }\r\n        }\r\n    }\r\n```\r\nWe add new tasks into wait group after it has been started. This cause the data race with\r\n\r\n```go\r\npm.downloads.Wait()\r\n```\r\n\r\n# Acceptance Criteria\r\n\r\nThere is no data race in the patch.\r\n\r\n@mandrigin "},"comment":{"url":"https://api.github.com/repos/status-im/status-go/issues/comments/368918955","html_url":"https://github.com/status-im/status-go/issues/709#issuecomment-368918955","issue_url":"https://api.github.com/repos/status-im/status-go/issues/709","id":368918955,"user":{"login":"JekaMas","id":3192700,"avatar_url":"https://avatars0.githubusercontent.com/u/3192700?v=4","gravatar_id":"","url":"https://api.github.com/users/JekaMas","html_url":"https://github.com/JekaMas","followers_url":"https://api.github.com/users/JekaMas/followers","following_url":"https://api.github.com/users/JekaMas/following{/other_user}","gists_url":"https://api.github.com/users/JekaMas/gists{/gist_id}","starred_url":"https://api.github.com/users/JekaMas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JekaMas/subscriptions","organizations_url":"https://api.github.com/users/JekaMas/orgs","repos_url":"https://api.github.com/users/JekaMas/repos","events_url":"https://api.github.com/users/JekaMas/events{/privacy}","received_events_url":"https://api.github.com/users/JekaMas/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T15:35:20Z","updated_at":"2018-02-27T15:35:20Z","author_association":"CONTRIBUTOR","body":"@mandrigin A nice fix! For me, it should work fine.\r\nHow to reproduce: it got this error once per 5 runs `go test -race -v -timeout 6000s ./t/e2e/whisper/whisper_jail_test.go -network=3`"}}
{"actor":{"display_login":"JekaMas"}}