{"action":"created","comment":{"url":"https://api.github.com/repos/nodejs/node/pulls/comments/196232031","pull_request_review_id":129746431,"id":196232031,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjIzMjAzMQ==","diff_hunk":"@@ -31,24 +32,51 @@ class TracingController : public v8::platform::tracing::TracingController {\n   }\n };\n \n+class Agent;\n \n-class Agent {\n+// Allows agent to be destroyed early. Methods are noop after the agent was\n+// destroyed\n+class AgentHandle {\n  public:\n-  // Resetting the pointer disconnects client\n-  using ClientHandle = std::unique_ptr<std::pair<Agent*, int>,\n-                                       void (*)(std::pair<Agent*, int>*)>;\n+  explicit AgentHandle(Agent*);\n+  void Reset();\n+  void AppendTraceEvent(TraceObject* trace_event);\n+  void Flush(bool blocking);\n+  void Disconnect(int client);\n \n-  static ClientHandle EmptyClientHandle() {\n-    return ClientHandle(nullptr, DisconnectClient);\n+ private:\n+  node::Mutex mutex_;\n+  Agent* agent_;\n+};\n+\n+class ClientHandle {\n+ public:\n+  ClientHandle(std::shared_ptr<AgentHandle> agent, int id)\n+               : agent_(agent), id_(id) {}\n+  ClientHandle(const ClientHandle&) = delete;\n+  ClientHandle& operator=(const ClientHandle&) = delete;\n+  ~ClientHandle();\n+  int id() {\n+    return id_;\n   }\n+\n+ private:\n+  std::shared_ptr<AgentHandle> agent_;\n+  int id_;","path":"src/tracing/agent.h","position":48,"original_position":48,"commit_id":"41b493d0d5a649afd8ef8341854d5ab6030456db","original_commit_id":"efd78491944bc106e240bda4de69bdac6185a40e","user":{"login":"bnoordhuis","id":275871,"node_id":"MDQ6VXNlcjI3NTg3MQ==","avatar_url":"https://avatars0.githubusercontent.com/u/275871?v=4","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"body":"And maybe make this `const` as well?","created_at":"2018-06-18T21:30:12Z","updated_at":"2018-06-18T21:31:22Z","html_url":"https://github.com/nodejs/node/pull/21335#discussion_r196232031","pull_request_url":"https://api.github.com/repos/nodejs/node/pulls/21335","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments/196232031"},"html":{"href":"https://github.com/nodejs/node/pull/21335#discussion_r196232031"},"pull_request":{"href":"https://api.github.com/repos/nodejs/node/pulls/21335"}}},"pull_request":{"url":"https://api.github.com/repos/nodejs/node/pulls/21335","id":195043488,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1MDQzNDg4","html_url":"https://github.com/nodejs/node/pull/21335","diff_url":"https://github.com/nodejs/node/pull/21335.diff","patch_url":"https://github.com/nodejs/node/pull/21335.patch","issue_url":"https://api.github.com/repos/nodejs/node/issues/21335","number":21335,"state":"open","locked":false,"title":"tracing: prevent race conditions during shutdown","user":{"login":"eugeneo","id":287917,"node_id":"MDQ6VXNlcjI4NzkxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/287917?v=4","gravatar_id":"","url":"https://api.github.com/users/eugeneo","html_url":"https://github.com/eugeneo","followers_url":"https://api.github.com/users/eugeneo/followers","following_url":"https://api.github.com/users/eugeneo/following{/other_user}","gists_url":"https://api.github.com/users/eugeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneo/subscriptions","organizations_url":"https://api.github.com/users/eugeneo/orgs","repos_url":"https://api.github.com/users/eugeneo/repos","events_url":"https://api.github.com/users/eugeneo/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneo/received_events","type":"User","site_admin":false},"body":"<!--\r\nThank you for your pull request. Please provide a description above and review\r\nthe requirements below.\r\n\r\nBug fixes and new features should include tests and possibly benchmarks.\r\n\r\nContributors guide: https://github.com/nodejs/node/blob/master/CONTRIBUTING.md\r\n-->\r\n\r\n##### Checklist\r\n<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->\r\n\r\n- [x] `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes\r\n- [x] commit message follows [commit guidelines](https://github.com/nodejs/node/blob/master/doc/guides/contributing/pull-requests.md#commit-message-guidelines)\r\n","created_at":"2018-06-14T23:24:49Z","updated_at":"2018-06-18T21:31:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbfe2a9a6b193207aeac6b0d91836539809247bc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":155267502,"node_id":"MDU6TGFiZWwxNTUyNjc1MDI=","url":"https://api.github.com/repos/nodejs/node/labels/C++","name":"C++","color":"e11d21","default":false},{"id":281232761,"node_id":"MDU6TGFiZWwyODEyMzI3NjE=","url":"https://api.github.com/repos/nodejs/node/labels/lib%20/%20src","name":"lib / src","color":"fad8c7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/nodejs/node/pulls/21335/commits","review_comments_url":"https://api.github.com/repos/nodejs/node/pulls/21335/comments","review_comment_url":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nodejs/node/issues/21335/comments","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/41b493d0d5a649afd8ef8341854d5ab6030456db","head":{"label":"eugeneo:tracing-crash","ref":"tracing-crash","sha":"41b493d0d5a649afd8ef8341854d5ab6030456db","user":{"login":"eugeneo","id":287917,"node_id":"MDQ6VXNlcjI4NzkxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/287917?v=4","gravatar_id":"","url":"https://api.github.com/users/eugeneo","html_url":"https://github.com/eugeneo","followers_url":"https://api.github.com/users/eugeneo/followers","following_url":"https://api.github.com/users/eugeneo/following{/other_user}","gists_url":"https://api.github.com/users/eugeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneo/subscriptions","organizations_url":"https://api.github.com/users/eugeneo/orgs","repos_url":"https://api.github.com/users/eugeneo/repos","events_url":"https://api.github.com/users/eugeneo/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneo/received_events","type":"User","site_admin":false},"repo":{"id":131190298,"node_id":"MDEwOlJlcG9zaXRvcnkxMzExOTAyOTg=","name":"node","full_name":"eugeneo/node","owner":{"login":"eugeneo","id":287917,"node_id":"MDQ6VXNlcjI4NzkxNw==","avatar_url":"https://avatars1.githubusercontent.com/u/287917?v=4","gravatar_id":"","url":"https://api.github.com/users/eugeneo","html_url":"https://github.com/eugeneo","followers_url":"https://api.github.com/users/eugeneo/followers","following_url":"https://api.github.com/users/eugeneo/following{/other_user}","gists_url":"https://api.github.com/users/eugeneo/gists{/gist_id}","starred_url":"https://api.github.com/users/eugeneo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eugeneo/subscriptions","organizations_url":"https://api.github.com/users/eugeneo/orgs","repos_url":"https://api.github.com/users/eugeneo/repos","events_url":"https://api.github.com/users/eugeneo/events{/privacy}","received_events_url":"https://api.github.com/users/eugeneo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eugeneo/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":true,"url":"https://api.github.com/repos/eugeneo/node","forks_url":"https://api.github.com/repos/eugeneo/node/forks","keys_url":"https://api.github.com/repos/eugeneo/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eugeneo/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eugeneo/node/teams","hooks_url":"https://api.github.com/repos/eugeneo/node/hooks","issue_events_url":"https://api.github.com/repos/eugeneo/node/issues/events{/number}","events_url":"https://api.github.com/repos/eugeneo/node/events","assignees_url":"https://api.github.com/repos/eugeneo/node/assignees{/user}","branches_url":"https://api.github.com/repos/eugeneo/node/branches{/branch}","tags_url":"https://api.github.com/repos/eugeneo/node/tags","blobs_url":"https://api.github.com/repos/eugeneo/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eugeneo/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eugeneo/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/eugeneo/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eugeneo/node/statuses/{sha}","languages_url":"https://api.github.com/repos/eugeneo/node/languages","stargazers_url":"https://api.github.com/repos/eugeneo/node/stargazers","contributors_url":"https://api.github.com/repos/eugeneo/node/contributors","subscribers_url":"https://api.github.com/repos/eugeneo/node/subscribers","subscription_url":"https://api.github.com/repos/eugeneo/node/subscription","commits_url":"https://api.github.com/repos/eugeneo/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/eugeneo/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/eugeneo/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/eugeneo/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/eugeneo/node/contents/{+path}","compare_url":"https://api.github.com/repos/eugeneo/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eugeneo/node/merges","archive_url":"https://api.github.com/repos/eugeneo/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eugeneo/node/downloads","issues_url":"https://api.github.com/repos/eugeneo/node/issues{/number}","pulls_url":"https://api.github.com/repos/eugeneo/node/pulls{/number}","milestones_url":"https://api.github.com/repos/eugeneo/node/milestones{/number}","notifications_url":"https://api.github.com/repos/eugeneo/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eugeneo/node/labels{/name}","releases_url":"https://api.github.com/repos/eugeneo/node/releases{/id}","deployments_url":"https://api.github.com/repos/eugeneo/node/deployments","created_at":"2018-04-26T17:37:48Z","updated_at":"2018-04-26T17:38:09Z","pushed_at":"2018-06-18T21:31:11Z","git_url":"git://github.com/eugeneo/node.git","ssh_url":"git@github.com:eugeneo/node.git","clone_url":"https://github.com/eugeneo/node.git","svn_url":"https://github.com/eugeneo/node","homepage":"https://nodejs.org","size":377963,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nodejs:master","ref":"master","sha":"baadc7ade3184560c5fbffe0be6c2446541936f5","user":{"login":"nodejs","id":9950313,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTAzMTM=","avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"repo":{"id":27193779,"node_id":"MDEwOlJlcG9zaXRvcnkyNzE5Mzc3OQ==","name":"node","full_name":"nodejs/node","owner":{"login":"nodejs","id":9950313,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk5NTAzMTM=","avatar_url":"https://avatars3.githubusercontent.com/u/9950313?v=4","gravatar_id":"","url":"https://api.github.com/users/nodejs","html_url":"https://github.com/nodejs","followers_url":"https://api.github.com/users/nodejs/followers","following_url":"https://api.github.com/users/nodejs/following{/other_user}","gists_url":"https://api.github.com/users/nodejs/gists{/gist_id}","starred_url":"https://api.github.com/users/nodejs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nodejs/subscriptions","organizations_url":"https://api.github.com/users/nodejs/orgs","repos_url":"https://api.github.com/users/nodejs/repos","events_url":"https://api.github.com/users/nodejs/events{/privacy}","received_events_url":"https://api.github.com/users/nodejs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nodejs/node","description":"Node.js JavaScript runtime :sparkles::turtle::rocket::sparkles:","fork":false,"url":"https://api.github.com/repos/nodejs/node","forks_url":"https://api.github.com/repos/nodejs/node/forks","keys_url":"https://api.github.com/repos/nodejs/node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nodejs/node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nodejs/node/teams","hooks_url":"https://api.github.com/repos/nodejs/node/hooks","issue_events_url":"https://api.github.com/repos/nodejs/node/issues/events{/number}","events_url":"https://api.github.com/repos/nodejs/node/events","assignees_url":"https://api.github.com/repos/nodejs/node/assignees{/user}","branches_url":"https://api.github.com/repos/nodejs/node/branches{/branch}","tags_url":"https://api.github.com/repos/nodejs/node/tags","blobs_url":"https://api.github.com/repos/nodejs/node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nodejs/node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nodejs/node/git/refs{/sha}","trees_url":"https://api.github.com/repos/nodejs/node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nodejs/node/statuses/{sha}","languages_url":"https://api.github.com/repos/nodejs/node/languages","stargazers_url":"https://api.github.com/repos/nodejs/node/stargazers","contributors_url":"https://api.github.com/repos/nodejs/node/contributors","subscribers_url":"https://api.github.com/repos/nodejs/node/subscribers","subscription_url":"https://api.github.com/repos/nodejs/node/subscription","commits_url":"https://api.github.com/repos/nodejs/node/commits{/sha}","git_commits_url":"https://api.github.com/repos/nodejs/node/git/commits{/sha}","comments_url":"https://api.github.com/repos/nodejs/node/comments{/number}","issue_comment_url":"https://api.github.com/repos/nodejs/node/issues/comments{/number}","contents_url":"https://api.github.com/repos/nodejs/node/contents/{+path}","compare_url":"https://api.github.com/repos/nodejs/node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nodejs/node/merges","archive_url":"https://api.github.com/repos/nodejs/node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nodejs/node/downloads","issues_url":"https://api.github.com/repos/nodejs/node/issues{/number}","pulls_url":"https://api.github.com/repos/nodejs/node/pulls{/number}","milestones_url":"https://api.github.com/repos/nodejs/node/milestones{/number}","notifications_url":"https://api.github.com/repos/nodejs/node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nodejs/node/labels{/name}","releases_url":"https://api.github.com/repos/nodejs/node/releases{/id}","deployments_url":"https://api.github.com/repos/nodejs/node/deployments","created_at":"2014-11-26T19:57:11Z","updated_at":"2018-06-18T21:08:54Z","pushed_at":"2018-06-18T21:18:40Z","git_url":"git://github.com/nodejs/node.git","ssh_url":"git@github.com:nodejs/node.git","clone_url":"https://github.com/nodejs/node.git","svn_url":"https://github.com/nodejs/node","homepage":"https://nodejs.org","size":385319,"stargazers_count":50434,"watchers_count":50434,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10580,"mirror_url":null,"archived":false,"open_issues_count":728,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":10580,"open_issues":728,"watchers":50434,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nodejs/node/pulls/21335"},"html":{"href":"https://github.com/nodejs/node/pull/21335"},"issue":{"href":"https://api.github.com/repos/nodejs/node/issues/21335"},"comments":{"href":"https://api.github.com/repos/nodejs/node/issues/21335/comments"},"review_comments":{"href":"https://api.github.com/repos/nodejs/node/pulls/21335/comments"},"review_comment":{"href":"https://api.github.com/repos/nodejs/node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nodejs/node/pulls/21335/commits"},"statuses":{"href":"https://api.github.com/repos/nodejs/node/statuses/41b493d0d5a649afd8ef8341854d5ab6030456db"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bnoordhuis"}}