{"action":"created","issue":{"url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/issues/11","labels_url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/issues/11/comments","events_url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/issues/11/events","html_url":"https://github.com/scraperwiki/tiny-ssl-reverse-proxy/issues/11","id":75215821,"number":11,"title":"websocket: client connection doesn't terminate when server does","user":{"login":"pwaller","id":438648,"avatar_url":"https://avatars.githubusercontent.com/u/438648?v=3","gravatar_id":"","url":"https://api.github.com/users/pwaller","html_url":"https://github.com/pwaller","followers_url":"https://api.github.com/users/pwaller/followers","following_url":"https://api.github.com/users/pwaller/following{/other_user}","gists_url":"https://api.github.com/users/pwaller/gists{/gist_id}","starred_url":"https://api.github.com/users/pwaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwaller/subscriptions","organizations_url":"https://api.github.com/users/pwaller/orgs","repos_url":"https://api.github.com/users/pwaller/repos","events_url":"https://api.github.com/users/pwaller/events{/privacy}","received_events_url":"https://api.github.com/users/pwaller/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-11T13:09:18Z","updated_at":"2015-05-11T13:19:17Z","closed_at":null,"body":"I've just noticed that if I restart a backend, the client keeps their connection open to the proxy.\r\n\r\nThis means that clients are not learning about server disconnects.\r\n\r\nThis is surprising, since I would have expected a server disconnect to result in an [EOF here](https://github.com/scraperwiki/tiny-ssl-reverse-proxy/blob/81f9a19b4d81a1e9cb2edbff1ba345692c26a12c/wscapableproxy.go#L123) and a [client close here](https://github.com/scraperwiki/tiny-ssl-reverse-proxy/blob/81f9a19b4d81a1e9cb2edbff1ba345692c26a12c/wscapableproxy.go#L61).\r\n\r\n~~Maybe the problem is that we're calling `inConn.Close` instead of `Underlying.Close`... Not sure how to arrange that correctly.~~ (edit: nope, both just result in a .Close() of the same thing)."},"comment":{"url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/issues/comments/100903569","html_url":"https://github.com/scraperwiki/tiny-ssl-reverse-proxy/issues/11#issuecomment-100903569","issue_url":"https://api.github.com/repos/scraperwiki/tiny-ssl-reverse-proxy/issues/11","id":100903569,"user":{"login":"pwaller","id":438648,"avatar_url":"https://avatars.githubusercontent.com/u/438648?v=3","gravatar_id":"","url":"https://api.github.com/users/pwaller","html_url":"https://github.com/pwaller","followers_url":"https://api.github.com/users/pwaller/followers","following_url":"https://api.github.com/users/pwaller/following{/other_user}","gists_url":"https://api.github.com/users/pwaller/gists{/gist_id}","starred_url":"https://api.github.com/users/pwaller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pwaller/subscriptions","organizations_url":"https://api.github.com/users/pwaller/orgs","repos_url":"https://api.github.com/users/pwaller/repos","events_url":"https://api.github.com/users/pwaller/events{/privacy}","received_events_url":"https://api.github.com/users/pwaller/received_events","type":"User","site_admin":false},"created_at":"2015-05-11T13:19:17Z","updated_at":"2015-05-11T13:19:17Z","body":"I strongly suspect this is causing the block:\r\n\r\nhttps://github.com/scraperwiki/tiny-ssl-reverse-proxy/blob/81f9a19b4d81a1e9cb2edbff1ba345692c26a12c/wscapableproxy.go#L113\r\n\r\nIt's waiting for the writer goroutine to finish, which only happens when `rawIn` is closed. Is a concurrent Read() and Close() legitimate? Maybe we have to signal the remote to close the connection with a Close websocket message."}}