{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/12734","labels_url":"https://api.github.com/repos/golang/go/issues/12734/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/12734/comments","events_url":"https://api.github.com/repos/golang/go/issues/12734/events","html_url":"https://github.com/golang/go/issues/12734","id":108083425,"number":12734,"title":"go 1.5.1 linux/amd64 deadlock detection failed","user":{"login":"wudizhanche1000","id":1272827,"avatar_url":"https://avatars.githubusercontent.com/u/1272827?v=3","gravatar_id":"","url":"https://api.github.com/users/wudizhanche1000","html_url":"https://github.com/wudizhanche1000","followers_url":"https://api.github.com/users/wudizhanche1000/followers","following_url":"https://api.github.com/users/wudizhanche1000/following{/other_user}","gists_url":"https://api.github.com/users/wudizhanche1000/gists{/gist_id}","starred_url":"https://api.github.com/users/wudizhanche1000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wudizhanche1000/subscriptions","organizations_url":"https://api.github.com/users/wudizhanche1000/orgs","repos_url":"https://api.github.com/users/wudizhanche1000/repos","events_url":"https://api.github.com/users/wudizhanche1000/events{/privacy}","received_events_url":"https://api.github.com/users/wudizhanche1000/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-24T08:26:30Z","updated_at":"2015-09-24T08:47:01Z","closed_at":"2015-09-24T08:47:01Z","body":"```\r\npackage main\r\n\r\nimport (\r\n\t\"log\"\r\n\t\"net/http\"\r\n)\r\n//delete this function, it would perform well\r\nfunc useless_func(address string) []byte {\r\n\thttp.Get(\"https://www.google.com\")\r\n\treturn nil\r\n}\r\nfunc test_a(test_channel chan int) {\r\n\ttest_channel <- 1\r\n\treturn\r\n}\r\n\r\nfunc test() {\r\n\ttest_channel := make(chan int)\r\n\tfor i := 0; i < 10; i++ {\r\n\t\tgo test_a(test_channel)\r\n\t}\r\n\tfor {\r\n\t\tlog.Println(<-test_channel)\r\n\t}\r\n}\r\nfunc main() {\r\n\ttest()\r\n}\r\n```\r\nthis code won't break because of clearly deadlock, it only happened under Linux with go 1.5.1. but if i delete useless_func and run it again, it would raise a deadlock error as expected."},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/142859447","html_url":"https://github.com/golang/go/issues/12734#issuecomment-142859447","issue_url":"https://api.github.com/repos/golang/go/issues/12734","id":142859447,"user":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T08:47:01Z","updated_at":"2015-09-24T08:47:01Z","body":"Importing the net package disables the deadlock detector. It has nothing to do with `net/http` or that func. For example, this also doesn't catch the deadlock:\r\n\r\n```go\r\npackage main\r\n\r\nimport \"log\"\r\nimport _ \"net\"\r\n\r\nfunc test_a(test_channel chan int) {\r\n        test_channel <- 1\r\n        return\r\n}\r\n\r\nfunc test() {\r\n        test_channel := make(chan int)\r\n        for i := 0; i < 10; i++ {\r\n                go test_a(test_channel)\r\n        }\r\n        for {\r\n                log.Println(<-test_channel)\r\n        }\r\n}\r\nfunc main() {\r\n        test()\r\n}\r\n```\r\n\r\nThe deadlock detector makes no guarantees. It basically only catches things with the most trivial programs.\r\n\r\n"}}