{"action":"created","issue":{"url":"https://api.github.com/repos/david415/HoneyBadger/issues/42","labels_url":"https://api.github.com/repos/david415/HoneyBadger/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/david415/HoneyBadger/issues/42/comments","events_url":"https://api.github.com/repos/david415/HoneyBadger/issues/42/events","html_url":"https://github.com/david415/HoneyBadger/issues/42","id":66781911,"number":42,"title":"Connection Close race","user":{"login":"david415","id":50611,"avatar_url":"https://avatars.githubusercontent.com/u/50611?v=3","gravatar_id":"","url":"https://api.github.com/users/david415","html_url":"https://github.com/david415","followers_url":"https://api.github.com/users/david415/followers","following_url":"https://api.github.com/users/david415/following{/other_user}","gists_url":"https://api.github.com/users/david415/gists{/gist_id}","starred_url":"https://api.github.com/users/david415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david415/subscriptions","organizations_url":"https://api.github.com/users/david415/orgs","repos_url":"https://api.github.com/users/david415/repos","events_url":"https://api.github.com/users/david415/events{/privacy}","received_events_url":"https://api.github.com/users/david415/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/david415/HoneyBadger/labels/bug","name":"bug","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"david415","id":50611,"avatar_url":"https://avatars.githubusercontent.com/u/50611?v=3","gravatar_id":"","url":"https://api.github.com/users/david415","html_url":"https://github.com/david415","followers_url":"https://api.github.com/users/david415/followers","following_url":"https://api.github.com/users/david415/following{/other_user}","gists_url":"https://api.github.com/users/david415/gists{/gist_id}","starred_url":"https://api.github.com/users/david415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david415/subscriptions","organizations_url":"https://api.github.com/users/david415/orgs","repos_url":"https://api.github.com/users/david415/repos","events_url":"https://api.github.com/users/david415/events{/privacy}","received_events_url":"https://api.github.com/users/david415/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2015-04-07T05:39:18Z","updated_at":"2015-04-25T00:03:49Z","closed_at":null,"body":"\r\nI'm not sure how to efficiently prevent this race. Currently there is some pretty hacky code in Connection's Close (in state_machine.go). Does Mischief have good design suggestions for avoid the race and handling the Close?\r\n\r\nThe counterpart to this located packetSource/service.go where we create the Connection.\r\n\r\npanic: send on closed channel\r\n\r\ngoroutine 9 [running]:\r\ngithub.com/david415/HoneyBadger/packetSource.(*Inquisitor).dispatchPackets(0xc2090de000)\r\n        /home/human/golang/gopkg/src/github.com/david415/HoneyBadger/packetSource/service.go:253 +0x411\r\ncreated by github.com/david415/HoneyBadger/packetSource.(*Inquisitor).Start\r\n        /home/human/golang/gopkg/src/github.com/david415/HoneyBadger/packetSource/service.go:100 +0x82\r\n\r\ngoroutine 1 [chan receive, 2 minutes]:\r\nmain.main()\r\n        /home/human/golang/gopkg/src/github.com/david415/HoneyBadger/cmd/honeyBadger/main.go:103 +0xb8a\r\n\r\ngoroutine 5 [syscall, 2 minutes]:\r\nos/signal.loop()\r\n        /home/human/golang/go/src/os/signal/signal_unix.go:21 +0x1f\r\ncreated by os/signal.init·1\r\n        /home/human/golang/go/src/os/signal/signal_unix.go:27 +0x35\r\n\r\ngoroutine 6 [select, 2 minutes]:\r\ngithub.com/david415/HoneyBadger/logging.(*AttackJsonLogger).receiveReports(0xc2090da450)\r\n        /home/human/golang/gopkg/src/github.com/david415/HoneyBadger/logging/attack_logger.go:74 +0x105\r\ncreated by github.com/david415/HoneyBadger/logging.(*AttackJsonLogger).Start\r\n        /home/human/golang/gopkg/src/github.com/david415/HoneyBadger/logging/attack_logger.go:65 +0x32\r\n"},"comment":{"url":"https://api.github.com/repos/david415/HoneyBadger/issues/comments/96103911","html_url":"https://github.com/david415/HoneyBadger/issues/42#issuecomment-96103911","issue_url":"https://api.github.com/repos/david415/HoneyBadger/issues/42","id":96103911,"user":{"login":"david415","id":50611,"avatar_url":"https://avatars.githubusercontent.com/u/50611?v=3","gravatar_id":"","url":"https://api.github.com/users/david415","html_url":"https://github.com/david415","followers_url":"https://api.github.com/users/david415/followers","following_url":"https://api.github.com/users/david415/following{/other_user}","gists_url":"https://api.github.com/users/david415/gists{/gist_id}","starred_url":"https://api.github.com/users/david415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david415/subscriptions","organizations_url":"https://api.github.com/users/david415/orgs","repos_url":"https://api.github.com/users/david415/repos","events_url":"https://api.github.com/users/david415/events{/privacy}","received_events_url":"https://api.github.com/users/david415/received_events","type":"User","site_admin":false},"created_at":"2015-04-25T00:03:49Z","updated_at":"2015-04-25T00:03:49Z","body":"and see here for my attempt to use channels to synchronize the CloseAllConnections\r\nhttps://github.com/david415/HoneyBadger/tree/42-fix-close-race-1-doneChan-1\r\n\r\nunit test fails in the same way:\r\n2015/04/25 00:57:28 Stop() - connection stopped: 1.2.3.4:1-2.3.4.5:2\r\nfatal error: all goroutines are asleep - deadlock!\r\n\r\ngoroutine 1 [chan receive]:\r\ntesting.RunTests(0x8bc418, 0x9f5e80, 0x12, 0x12, 0x1)\r\n\t/home/user/go/src/testing/testing.go:556 +0xdc3\r\ntesting.(*M).Run(0xc2080300f0, 0xf28e80)\r\n\t/home/user/go/src/testing/testing.go:485 +0xe1\r\nmain.main()\r\n\tgithub.com/david415/HoneyBadger/_test/_testmain.go:86 +0x28d\r\n\r\ngoroutine 5 [chan receive]:\r\ngithub.com/david415/HoneyBadger.(*ConnectionPool).CloseAllConnections(0xc20987f100, 0x0)\r\n\t/home/user/go/gopath/src/github.com/david415/HoneyBadger/connection_pool.go:103 +0x1b5\r\n"}}