{"action":"created","issue":{"url":"https://api.github.com/repos/cloudwu/skynet/issues/314","labels_url":"https://api.github.com/repos/cloudwu/skynet/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/cloudwu/skynet/issues/314/comments","events_url":"https://api.github.com/repos/cloudwu/skynet/issues/314/events","html_url":"https://github.com/cloudwu/skynet/issues/314","id":98693162,"number":314,"title":"\b关于socketchannel的疑问","user":{"login":"hqwrong","id":1390820,"avatar_url":"https://avatars.githubusercontent.com/u/1390820?v=3","gravatar_id":"","url":"https://api.github.com/users/hqwrong","html_url":"https://github.com/hqwrong","followers_url":"https://api.github.com/users/hqwrong/followers","following_url":"https://api.github.com/users/hqwrong/following{/other_user}","gists_url":"https://api.github.com/users/hqwrong/gists{/gist_id}","starred_url":"https://api.github.com/users/hqwrong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hqwrong/subscriptions","organizations_url":"https://api.github.com/users/hqwrong/orgs","repos_url":"https://api.github.com/users/hqwrong/repos","events_url":"https://api.github.com/users/hqwrong/events{/privacy}","received_events_url":"https://api.github.com/users/hqwrong/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-08-03T08:06:11Z","updated_at":"2015-08-04T08:36:35Z","closed_at":null,"body":"关于socketchannel，有个问题没想明白。\r\n\r\nsocketchannel是异步send，有一个poll的大循环来处理socket的事件，如果侦测到这个socket已被对方关闭的话，就会给该socket置一个INVALID标志，并通知发起写请求的服务。这个服务收到通知后会清掉对应状态，下次再发起写请求，它会尝试重连。\r\n\r\n我没想明白的是，是不是有这种情况：\r\n\r\n   如果底层侦测到socket被对方关闭，将该socket状态置为INVALID，但发起服务还没有收到底层的通知，这时它再发起写请求，还会重用这个invalid socket, 那么代码应该会报错.\r\n\r\n这是在服务器上收集到的log，可能和这个有关:\r\n\r\n./skynet/lualib/socketchannel.lua:268: in function 'request'\r\n./service/replay.lua:53: in function 'func'\r\n./skynet/lualib/skynet.lua:370: in function 'f'\r\n./skynet/lualib/skynet.lua:113: in function <./skynet/lualib/skynet.lua:112>\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/cloudwu/skynet/issues/comments/127527341","html_url":"https://github.com/cloudwu/skynet/issues/314#issuecomment-127527341","issue_url":"https://api.github.com/repos/cloudwu/skynet/issues/314","id":127527341,"user":{"login":"jintiao","id":8506004,"avatar_url":"https://avatars.githubusercontent.com/u/8506004?v=3","gravatar_id":"","url":"https://api.github.com/users/jintiao","html_url":"https://github.com/jintiao","followers_url":"https://api.github.com/users/jintiao/followers","following_url":"https://api.github.com/users/jintiao/following{/other_user}","gists_url":"https://api.github.com/users/jintiao/gists{/gist_id}","starred_url":"https://api.github.com/users/jintiao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jintiao/subscriptions","organizations_url":"https://api.github.com/users/jintiao/orgs","repos_url":"https://api.github.com/users/jintiao/repos","events_url":"https://api.github.com/users/jintiao/events{/privacy}","received_events_url":"https://api.github.com/users/jintiao/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T08:36:35Z","updated_at":"2015-08-04T08:36:35Z","body":"我插一句，涉及到IO失败这类错误，你想要框架怎么处理，通知你还是不通知你呢，现在没有任何系统能保证IO操作100%成功啊"}}