{"action":"created","issue":{"url":"https://api.github.com/repos/jeffallen/mqtt/issues/5","labels_url":"https://api.github.com/repos/jeffallen/mqtt/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/jeffallen/mqtt/issues/5/comments","events_url":"https://api.github.com/repos/jeffallen/mqtt/issues/5/events","html_url":"https://github.com/jeffallen/mqtt/issues/5","id":111621798,"number":5,"title":"loadtest causes mqttsrv to try to use closed network connections","user":{"login":"atilaneves","id":4956425,"avatar_url":"https://avatars.githubusercontent.com/u/4956425?v=3","gravatar_id":"","url":"https://api.github.com/users/atilaneves","html_url":"https://github.com/atilaneves","followers_url":"https://api.github.com/users/atilaneves/followers","following_url":"https://api.github.com/users/atilaneves/following{/other_user}","gists_url":"https://api.github.com/users/atilaneves/gists{/gist_id}","starred_url":"https://api.github.com/users/atilaneves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atilaneves/subscriptions","organizations_url":"https://api.github.com/users/atilaneves/orgs","repos_url":"https://api.github.com/users/atilaneves/repos","events_url":"https://api.github.com/users/atilaneves/events{/privacy}","received_events_url":"https://api.github.com/users/atilaneves/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-15T13:53:35Z","updated_at":"2015-10-16T06:00:36Z","closed_at":null,"body":"With Go 1.5 on Arch Linux, running the server then loadtest with `--messages=500 --conns=500` never completes due to unreceived messages. The server prints:\r\n\r\n    2015/10/15 15:51:14 {IncomingConn: 242846536268381992}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 {IncomingConn: 5207166632368852897}: failed to submit message\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46156: use of closed network connection\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46138: use of closed network connection\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46384: use of closed network connection\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46226: use of closed network connection\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46268: use of closed network connection\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46348: use of closed network connection\r\n    2015/10/15 15:51:14 writer: write tcp [::1]:1883->[::1]:46442: use of closed network connection\r\n"},"comment":{"url":"https://api.github.com/repos/jeffallen/mqtt/issues/comments/148617638","html_url":"https://github.com/jeffallen/mqtt/issues/5#issuecomment-148617638","issue_url":"https://api.github.com/repos/jeffallen/mqtt/issues/5","id":148617638,"user":{"login":"jeffallen","id":1131456,"avatar_url":"https://avatars.githubusercontent.com/u/1131456?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffallen","html_url":"https://github.com/jeffallen","followers_url":"https://api.github.com/users/jeffallen/followers","following_url":"https://api.github.com/users/jeffallen/following{/other_user}","gists_url":"https://api.github.com/users/jeffallen/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffallen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffallen/subscriptions","organizations_url":"https://api.github.com/users/jeffallen/orgs","repos_url":"https://api.github.com/users/jeffallen/repos","events_url":"https://api.github.com/users/jeffallen/events{/privacy}","received_events_url":"https://api.github.com/users/jeffallen/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T06:00:36Z","updated_at":"2015-10-16T06:00:36Z","body":"Crazy, I can repro with only 2 concurrent connections. With loadtest and mqttsrv built with Go 1.5, I see this:\r\n\r\n$ ./loadtest --messages=500 --conns=2\r\n$ ./mqttsrv\r\n2015/10/16 11:57:16 New client connected from 127.0.0.1:51462 as 6106767223293117013 (c1, k0).\r\n2015/10/16 11:57:16 New client connected from 127.0.0.1:51463 as 6262886128805217406 (c1, k0).\r\n2015/10/16 11:57:16 writer: write tcp 127.0.0.1:1883->127.0.0.1:51463: use of closed network connection\r\n\r\nRecompile mqttsrv with Go 1.4.2 and the problem goes away. My testing is on MacOS, not Arch Linux, so it is a wider problem than just Linux.\r\n\r\nStill diggin."}}