{"action":"created","comment":{"url":"https://api.github.com/repos/ceph/ceph/pulls/comments/78042457","id":78042457,"diff_hunk":"@@ -263,50 +321,84 @@ void *Accepter::entry()\n     if (sd >= 0) {\n       int r = set_close_on_exec(sd);\n       if (r) {\n-\tldout(msgr->cct,0) << \"accepter set_close_on_exec() failed \"\n+\tldout(msgr->cct,0) << __func__ << \" set_close_on_exec() failed \"\n \t      << cpp_strerror(r) << dendl;\n       }\n       errors = 0;\n-      ldout(msgr->cct,10) << \"accepted incoming on sd \" << sd << dendl;\n+      ldout(msgr->cct,10) << __func__ << \" incoming on sd \" << sd << dendl;\n       \n       msgr->add_accept_pipe(sd);\n     } else {\n-      ldout(msgr->cct,0) << \"accepter no incoming connection?  sd = \" << sd\n+      ldout(msgr->cct,0) << __func__ << \" no incoming connection?  sd = \" << sd\n \t      << \" errno \" << errno << \" \" << cpp_strerror(errno) << dendl;\n       if (++errors > 4)\n \tbreak;\n     }\n   }\n \n-  ldout(msgr->cct,20) << \"accepter closing\" << dendl;\n+  ldout(msgr->cct,20) << __func__ << \" closing\" << dendl;\n   // don't close socket, in case we start up again?  blech.\n-  if (listen_sd >= 0) {\n-    ::close(listen_sd);\n-    listen_sd = -1;\n-  }\n-  ldout(msgr->cct,10) << \"accepter stopping\" << dendl;\n+  // if (listen_sd >= 0) {\n+  //   ::close(listen_sd);\n+  //   listen_sd = -1;\n+  // }\n+  if (shutdown_rd_fd >= 0) {\n+       ::close(shutdown_rd_fd);\n+       shutdown_rd_fd = -1;\n+   }\n+\n+  ldout(msgr->cct,10) << __func__ << \" stopping\" << dendl;\n   return 0;\n }\n \n void Accepter::stop()\n {\n   done = true;\n-  ldout(msgr->cct,10) << \"stop accepter\" << dendl;\n-\n-  if (listen_sd >= 0) {\n-    ::shutdown(listen_sd, SHUT_RDWR);\n+  ldout(msgr->cct,10) << __func__ << \" accept listening on: \" << listen_sd << dendl;\n+\n+  if (shutdown_wr_fd < 0)\n+    return;\n+\n+  // Send a byte to the shutdown pipe that the thread is listening to\n+  char buf[1] = { 0x0 };\n+  int ret = safe_write(shutdown_wr_fd, buf, 1);\n+  if (ret < 0) {\n+      ldout(msgr->cct,10) << __func__ << \"close failed: \"\n+             << \" errno \" << errno << \" \" << cpp_strerror(errno) << dendl;\n+  }  else {\n+      ldout(msgr->cct,15) << __func__ << \" signaled poll\" << dendl;\n   }\n+  VOID_TEMP_FAILURE_RETRY(close(shutdown_wr_fd));\n+  shutdown_wr_fd = -1;\n \n   // wait for thread to stop before closing the socket, to avoid\n   // racing against fd re-use.\n   if (is_started()) {\n+      ldout(msgr->cct,0) << __func__ << \" wait for thread to join.\" << dendl;\n     join();\n   }\n \n   if (listen_sd >= 0) {\n-    ::close(listen_sd);\n+    if (::close(listen_sd) < 0) {\n+      ldout(msgr->cct,10) << __func__ << \"close listen_sd failed: \"\n+\t      << \" errno \" << errno << \" \" << cpp_strerror(errno) << dendl;\n+    }\n     listen_sd = -1;\n   }\n+  if (shutdown_rd_fd >= 0) {\n+\tif (::close(shutdown_rd_fd) < 0) {\n+      ldout(msgr->cct,10) << __func__ << \"close shutdown_rd_fd failed: \"\n+\t      << \" errno \" << errno << \" \" << cpp_strerror(errno) << dendl;\n+    }\n+\tshutdown_rd_fd = -1;\n+  }\n+  if (shutdown_wr_fd >= 0) {","path":"src/msg/simple/Accepter.cc","position":362,"original_position":362,"commit_id":"6483ceab96509e5b6352b6608a9a66099ff156c4","original_commit_id":"6483ceab96509e5b6352b6608a9a66099ff156c4","user":{"login":"yuyuyu101","id":980577,"avatar_url":"https://avatars.githubusercontent.com/u/980577?v=3","gravatar_id":"","url":"https://api.github.com/users/yuyuyu101","html_url":"https://github.com/yuyuyu101","followers_url":"https://api.github.com/users/yuyuyu101/followers","following_url":"https://api.github.com/users/yuyuyu101/following{/other_user}","gists_url":"https://api.github.com/users/yuyuyu101/gists{/gist_id}","starred_url":"https://api.github.com/users/yuyuyu101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuyuyu101/subscriptions","organizations_url":"https://api.github.com/users/yuyuyu101/orgs","repos_url":"https://api.github.com/users/yuyuyu101/repos","events_url":"https://api.github.com/users/yuyuyu101/events{/privacy}","received_events_url":"https://api.github.com/users/yuyuyu101/received_events","type":"User","site_admin":false},"body":"shutdown_wr_fd must be -1 now","created_at":"2016-09-08T16:37:26Z","updated_at":"2016-09-08T16:37:26Z","html_url":"https://github.com/ceph/ceph/pull/10720#discussion_r78042457","pull_request_url":"https://api.github.com/repos/ceph/ceph/pulls/10720","_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments/78042457"},"html":{"href":"https://github.com/ceph/ceph/pull/10720#discussion_r78042457"},"pull_request":{"href":"https://api.github.com/repos/ceph/ceph/pulls/10720"}}},"pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/10720","id":81213397,"html_url":"https://github.com/ceph/ceph/pull/10720","diff_url":"https://github.com/ceph/ceph/pull/10720.diff","patch_url":"https://github.com/ceph/ceph/pull/10720.patch","issue_url":"https://api.github.com/repos/ceph/ceph/issues/10720","number":10720,"state":"open","locked":false,"title":"msg/simple/Accepter.cc: replace shutdown() with selfpipe event in poll() (FreeBSD)","user":{"login":"wjwithagen","id":16081914,"avatar_url":"https://avatars.githubusercontent.com/u/16081914?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwithagen","html_url":"https://github.com/wjwithagen","followers_url":"https://api.github.com/users/wjwithagen/followers","following_url":"https://api.github.com/users/wjwithagen/following{/other_user}","gists_url":"https://api.github.com/users/wjwithagen/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwithagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwithagen/subscriptions","organizations_url":"https://api.github.com/users/wjwithagen/orgs","repos_url":"https://api.github.com/users/wjwithagen/repos","events_url":"https://api.github.com/users/wjwithagen/events{/privacy}","received_events_url":"https://api.github.com/users/wjwithagen/received_events","type":"User","site_admin":false},"body":"…socket.\r\n\r\nIn FreeBSD a shutdown on the socket here can generate:\r\n  accepter.stop shutdown failed:  errno 57 (57) Socket is not connected\r\nBut that does not trigger an event with the poll on the socket.\r\n\r\nClosing the socket does.\r\n\r\nSigned-off-by: Willem Jan Withagen <wjw@digiware.nl>","created_at":"2016-08-13T11:06:22Z","updated_at":"2016-09-08T16:37:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6514493d3f783035de4e8f0475a6805989d2876e","assignee":{"login":"tchaikov","id":59071,"avatar_url":"https://avatars.githubusercontent.com/u/59071?v=3","gravatar_id":"","url":"https://api.github.com/users/tchaikov","html_url":"https://github.com/tchaikov","followers_url":"https://api.github.com/users/tchaikov/followers","following_url":"https://api.github.com/users/tchaikov/following{/other_user}","gists_url":"https://api.github.com/users/tchaikov/gists{/gist_id}","starred_url":"https://api.github.com/users/tchaikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchaikov/subscriptions","organizations_url":"https://api.github.com/users/tchaikov/orgs","repos_url":"https://api.github.com/users/tchaikov/repos","events_url":"https://api.github.com/users/tchaikov/events{/privacy}","received_events_url":"https://api.github.com/users/tchaikov/received_events","type":"User","site_admin":false},"assignees":[{"login":"tchaikov","id":59071,"avatar_url":"https://avatars.githubusercontent.com/u/59071?v=3","gravatar_id":"","url":"https://api.github.com/users/tchaikov","html_url":"https://github.com/tchaikov","followers_url":"https://api.github.com/users/tchaikov/followers","following_url":"https://api.github.com/users/tchaikov/following{/other_user}","gists_url":"https://api.github.com/users/tchaikov/gists{/gist_id}","starred_url":"https://api.github.com/users/tchaikov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchaikov/subscriptions","organizations_url":"https://api.github.com/users/tchaikov/orgs","repos_url":"https://api.github.com/users/tchaikov/repos","events_url":"https://api.github.com/users/tchaikov/events{/privacy}","received_events_url":"https://api.github.com/users/tchaikov/received_events","type":"User","site_admin":false},{"login":"liewegas","id":433031,"avatar_url":"https://avatars.githubusercontent.com/u/433031?v=3","gravatar_id":"","url":"https://api.github.com/users/liewegas","html_url":"https://github.com/liewegas","followers_url":"https://api.github.com/users/liewegas/followers","following_url":"https://api.github.com/users/liewegas/following{/other_user}","gists_url":"https://api.github.com/users/liewegas/gists{/gist_id}","starred_url":"https://api.github.com/users/liewegas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/liewegas/subscriptions","organizations_url":"https://api.github.com/users/liewegas/orgs","repos_url":"https://api.github.com/users/liewegas/repos","events_url":"https://api.github.com/users/liewegas/events{/privacy}","received_events_url":"https://api.github.com/users/liewegas/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ceph/ceph/pulls/10720/commits","review_comments_url":"https://api.github.com/repos/ceph/ceph/pulls/10720/comments","review_comment_url":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/10720/comments","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/6483ceab96509e5b6352b6608a9a66099ff156c4","head":{"label":"wjwithagen:wip-wjw-freebsd-socket-shutdown","ref":"wip-wjw-freebsd-socket-shutdown","sha":"6483ceab96509e5b6352b6608a9a66099ff156c4","user":{"login":"wjwithagen","id":16081914,"avatar_url":"https://avatars.githubusercontent.com/u/16081914?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwithagen","html_url":"https://github.com/wjwithagen","followers_url":"https://api.github.com/users/wjwithagen/followers","following_url":"https://api.github.com/users/wjwithagen/following{/other_user}","gists_url":"https://api.github.com/users/wjwithagen/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwithagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwithagen/subscriptions","organizations_url":"https://api.github.com/users/wjwithagen/orgs","repos_url":"https://api.github.com/users/wjwithagen/repos","events_url":"https://api.github.com/users/wjwithagen/events{/privacy}","received_events_url":"https://api.github.com/users/wjwithagen/received_events","type":"User","site_admin":false},"repo":{"id":50789401,"name":"ceph","full_name":"wjwithagen/ceph","owner":{"login":"wjwithagen","id":16081914,"avatar_url":"https://avatars.githubusercontent.com/u/16081914?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwithagen","html_url":"https://github.com/wjwithagen","followers_url":"https://api.github.com/users/wjwithagen/followers","following_url":"https://api.github.com/users/wjwithagen/following{/other_user}","gists_url":"https://api.github.com/users/wjwithagen/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwithagen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwithagen/subscriptions","organizations_url":"https://api.github.com/users/wjwithagen/orgs","repos_url":"https://api.github.com/users/wjwithagen/repos","events_url":"https://api.github.com/users/wjwithagen/events{/privacy}","received_events_url":"https://api.github.com/users/wjwithagen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wjwithagen/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":true,"url":"https://api.github.com/repos/wjwithagen/ceph","forks_url":"https://api.github.com/repos/wjwithagen/ceph/forks","keys_url":"https://api.github.com/repos/wjwithagen/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wjwithagen/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wjwithagen/ceph/teams","hooks_url":"https://api.github.com/repos/wjwithagen/ceph/hooks","issue_events_url":"https://api.github.com/repos/wjwithagen/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/wjwithagen/ceph/events","assignees_url":"https://api.github.com/repos/wjwithagen/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/wjwithagen/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/wjwithagen/ceph/tags","blobs_url":"https://api.github.com/repos/wjwithagen/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wjwithagen/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wjwithagen/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/wjwithagen/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wjwithagen/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/wjwithagen/ceph/languages","stargazers_url":"https://api.github.com/repos/wjwithagen/ceph/stargazers","contributors_url":"https://api.github.com/repos/wjwithagen/ceph/contributors","subscribers_url":"https://api.github.com/repos/wjwithagen/ceph/subscribers","subscription_url":"https://api.github.com/repos/wjwithagen/ceph/subscription","commits_url":"https://api.github.com/repos/wjwithagen/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/wjwithagen/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/wjwithagen/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/wjwithagen/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/wjwithagen/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/wjwithagen/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wjwithagen/ceph/merges","archive_url":"https://api.github.com/repos/wjwithagen/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wjwithagen/ceph/downloads","issues_url":"https://api.github.com/repos/wjwithagen/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/wjwithagen/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/wjwithagen/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/wjwithagen/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wjwithagen/ceph/labels{/name}","releases_url":"https://api.github.com/repos/wjwithagen/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/wjwithagen/ceph/deployments","created_at":"2016-01-31T18:48:17Z","updated_at":"2016-07-28T08:35:18Z","pushed_at":"2016-09-08T12:54:44Z","git_url":"git://github.com/wjwithagen/ceph.git","ssh_url":"git@github.com:wjwithagen/ceph.git","clone_url":"https://github.com/wjwithagen/ceph.git","svn_url":"https://github.com/wjwithagen/ceph","homepage":"http://ceph.com","size":176423,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"ceph:master","ref":"master","sha":"549812338e36ae865ad6a7a0be12b666e0a485ab","user":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"repo":{"id":2310495,"name":"ceph","full_name":"ceph/ceph","owner":{"login":"ceph","id":1015767,"avatar_url":"https://avatars.githubusercontent.com/u/1015767?v=3","gravatar_id":"","url":"https://api.github.com/users/ceph","html_url":"https://github.com/ceph","followers_url":"https://api.github.com/users/ceph/followers","following_url":"https://api.github.com/users/ceph/following{/other_user}","gists_url":"https://api.github.com/users/ceph/gists{/gist_id}","starred_url":"https://api.github.com/users/ceph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceph/subscriptions","organizations_url":"https://api.github.com/users/ceph/orgs","repos_url":"https://api.github.com/users/ceph/repos","events_url":"https://api.github.com/users/ceph/events{/privacy}","received_events_url":"https://api.github.com/users/ceph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ceph/ceph","description":"Ceph is a distributed object, block, and file storage platform ","fork":false,"url":"https://api.github.com/repos/ceph/ceph","forks_url":"https://api.github.com/repos/ceph/ceph/forks","keys_url":"https://api.github.com/repos/ceph/ceph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceph/ceph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceph/ceph/teams","hooks_url":"https://api.github.com/repos/ceph/ceph/hooks","issue_events_url":"https://api.github.com/repos/ceph/ceph/issues/events{/number}","events_url":"https://api.github.com/repos/ceph/ceph/events","assignees_url":"https://api.github.com/repos/ceph/ceph/assignees{/user}","branches_url":"https://api.github.com/repos/ceph/ceph/branches{/branch}","tags_url":"https://api.github.com/repos/ceph/ceph/tags","blobs_url":"https://api.github.com/repos/ceph/ceph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceph/ceph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceph/ceph/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceph/ceph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceph/ceph/statuses/{sha}","languages_url":"https://api.github.com/repos/ceph/ceph/languages","stargazers_url":"https://api.github.com/repos/ceph/ceph/stargazers","contributors_url":"https://api.github.com/repos/ceph/ceph/contributors","subscribers_url":"https://api.github.com/repos/ceph/ceph/subscribers","subscription_url":"https://api.github.com/repos/ceph/ceph/subscription","commits_url":"https://api.github.com/repos/ceph/ceph/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceph/ceph/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceph/ceph/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceph/ceph/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceph/ceph/contents/{+path}","compare_url":"https://api.github.com/repos/ceph/ceph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceph/ceph/merges","archive_url":"https://api.github.com/repos/ceph/ceph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceph/ceph/downloads","issues_url":"https://api.github.com/repos/ceph/ceph/issues{/number}","pulls_url":"https://api.github.com/repos/ceph/ceph/pulls{/number}","milestones_url":"https://api.github.com/repos/ceph/ceph/milestones{/number}","notifications_url":"https://api.github.com/repos/ceph/ceph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceph/ceph/labels{/name}","releases_url":"https://api.github.com/repos/ceph/ceph/releases{/id}","deployments_url":"https://api.github.com/repos/ceph/ceph/deployments","created_at":"2011-09-01T21:41:26Z","updated_at":"2016-09-08T15:15:40Z","pushed_at":"2016-09-08T16:13:57Z","git_url":"git://github.com/ceph/ceph.git","ssh_url":"git@github.com:ceph/ceph.git","clone_url":"https://github.com/ceph/ceph.git","svn_url":"https://github.com/ceph/ceph","homepage":"http://ceph.com","size":239071,"stargazers_count":2454,"watchers_count":2454,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1448,"mirror_url":null,"open_issues_count":445,"forks":1448,"open_issues":445,"watchers":2454,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ceph/ceph/pulls/10720"},"html":{"href":"https://github.com/ceph/ceph/pull/10720"},"issue":{"href":"https://api.github.com/repos/ceph/ceph/issues/10720"},"comments":{"href":"https://api.github.com/repos/ceph/ceph/issues/10720/comments"},"review_comments":{"href":"https://api.github.com/repos/ceph/ceph/pulls/10720/comments"},"review_comment":{"href":"https://api.github.com/repos/ceph/ceph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ceph/ceph/pulls/10720/commits"},"statuses":{"href":"https://api.github.com/repos/ceph/ceph/statuses/6483ceab96509e5b6352b6608a9a66099ff156c4"}}}}
{"actor":{"display_login":"yuyuyu101"}}