{"action":"opened","issue":{"url":"https://api.github.com/repos/prometheus/prometheus/issues/1493","repository_url":"https://api.github.com/repos/prometheus/prometheus","labels_url":"https://api.github.com/repos/prometheus/prometheus/issues/1493/labels{/name}","comments_url":"https://api.github.com/repos/prometheus/prometheus/issues/1493/comments","events_url":"https://api.github.com/repos/prometheus/prometheus/issues/1493/events","html_url":"https://github.com/prometheus/prometheus/issues/1493","id":141628797,"number":1493,"title":"Race conditions in retrieval","user":{"login":"beorn7","id":5609886,"avatar_url":"https://avatars.githubusercontent.com/u/5609886?v=3","gravatar_id":"","url":"https://api.github.com/users/beorn7","html_url":"https://github.com/beorn7","followers_url":"https://api.github.com/users/beorn7/followers","following_url":"https://api.github.com/users/beorn7/following{/other_user}","gists_url":"https://api.github.com/users/beorn7/gists{/gist_id}","starred_url":"https://api.github.com/users/beorn7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beorn7/subscriptions","organizations_url":"https://api.github.com/users/beorn7/orgs","repos_url":"https://api.github.com/users/beorn7/repos","events_url":"https://api.github.com/users/beorn7/events{/privacy}","received_events_url":"https://api.github.com/users/beorn7/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/prometheus/prometheus/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/prometheus/prometheus/labels/Critical","name":"Critical","color":"e102d8"}],"state":"open","locked":false,"assignee":{"login":"fabxc","id":4948210,"avatar_url":"https://avatars.githubusercontent.com/u/4948210?v=3","gravatar_id":"","url":"https://api.github.com/users/fabxc","html_url":"https://github.com/fabxc","followers_url":"https://api.github.com/users/fabxc/followers","following_url":"https://api.github.com/users/fabxc/following{/other_user}","gists_url":"https://api.github.com/users/fabxc/gists{/gist_id}","starred_url":"https://api.github.com/users/fabxc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabxc/subscriptions","organizations_url":"https://api.github.com/users/fabxc/orgs","repos_url":"https://api.github.com/users/fabxc/repos","events_url":"https://api.github.com/users/fabxc/events{/privacy}","received_events_url":"https://api.github.com/users/fabxc/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2016-03-17T16:06:01Z","updated_at":"2016-03-17T16:06:01Z","closed_at":null,"body":"At commit e83f05fe93c32c9e808b2a6a907337b442a540dc  (but surely introduced earlier, just for line number reference).\r\n\r\n```\r\n==================\r\nWARNING: DATA RACE\r\nRead by goroutine 116:\r\n  github.com/prometheus/prometheus/retrieval.(*scrapePool).sync()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/scrape.go:227 +0x408\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).sync()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:258 +0x2b6\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runProviders()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:331 +0x41b\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:124 +0x31c\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).Run()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:79 +0x243\r\n\r\nPrevious write by goroutine 59:\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runScraping()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:227 +0xe9\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload.func1()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:118 +0x67\r\n==================\r\n\r\n\r\n\r\n==================\r\nWARNING: DATA RACE\r\nRead by goroutine 116:\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.(*cancelCtx).Done()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:304 +0x33\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.propagateCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:227 +0x38\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:213 +0x276\r\n  github.com/prometheus/prometheus/retrieval.newScrapeLoop()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/scrape.go:379 +0x1a3\r\n  github.com/prometheus/prometheus/retrieval.(*scrapePool).sync()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/scrape.go:227 +0x495\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).sync()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:258 +0x2b6\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runProviders()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:331 +0x41b\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:124 +0x31c\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).Run()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:79 +0x243\r\n\r\nPrevious write by goroutine 59:\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:212 +0x1fc\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runScraping()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:225 +0x4d\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload.func1()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:118 +0x67\r\n==================\r\n\r\n\r\n==================\r\nWARNING: DATA RACE\r\nWrite by goroutine 116:\r\n  sync/atomic.CompareAndSwapInt32()\r\n      /usr/local/go/src/runtime/race_amd64.s:279 +0xb\r\n  sync.(*Mutex).Lock()\r\n      /usr/local/go/src/sync/mutex.go:44 +0x4d\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.propagateCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:231 +0x97\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:213 +0x276\r\n  github.com/prometheus/prometheus/retrieval.newScrapeLoop()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/scrape.go:379 +0x1a3\r\n  github.com/prometheus/prometheus/retrieval.(*scrapePool).sync()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/scrape.go:227 +0x495\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).sync()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:258 +0x2b6\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runProviders()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:331 +0x41b\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:124 +0x31c\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).Run()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:79 +0x243\r\n\r\nPrevious write by goroutine 59:\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:212 +0x1fc\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runScraping()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:225 +0x4d\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload.func1()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:118 +0x67\r\n==================\r\n\r\n\r\n==================\r\nWARNING: DATA RACE\r\nRead by goroutine 60:\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.(*cancelCtx).Deadline()\r\n      <autogenerated>:7 +0x5a\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.(*cancelCtx).Deadline()\r\n      <autogenerated>:7 +0x80\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithDeadline()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:352 +0x6a\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithTimeout()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:419 +0x11a\r\n  github.com/prometheus/prometheus/retrieval.(*scrapeLoop).run()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/scrape.go:409 +0x365\r\n\r\nPrevious write by goroutine 59:\r\n  github.com/prometheus/prometheus/vendor/golang.org/x/net/context.WithCancel()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/vendor/golang.org/x/net/context/context.go:212 +0x1fc\r\n  github.com/prometheus/prometheus/retrieval.(*targetSet).runScraping()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:225 +0x4d\r\n  github.com/prometheus/prometheus/retrieval.(*TargetManager).reload.func1()\r\n      /home/bjoern/gocode/src/github.com/prometheus/prometheus/retrieval/targetmanager.go:118 +0x67\r\n```\r\n\r\nLet me know if you want the \"createt at\" parts, too."}}