{"action":"created","comment":{"url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments/194388305","pull_request_review_id":127548996,"id":194388305,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDM4ODMwNQ==","diff_hunk":"@@ -316,58 +317,63 @@ mod tests {\n \t\t::logger::init_log();\n \t\tlet path = \"/tmp/test-ipc-40000\";\n \t\tlet server = run(path);\n-\t\tthread::sleep(::std::time::Duration::from_millis(1000));\n+\t\tlet (stop_signal, stop_receiver) = oneshot::channel();\n \n-\t\tlet result = dummy_request_str(\n-\t\t\tpath,\n-\t\t\t\"{\\\"jsonrpc\\\": \\\"2.0\\\", \\\"method\\\": \\\"say_hello\\\", \\\"params\\\": [42, 23], \\\"id\\\": 1}\",\n+\t\tlet _ = thread::spawn(move || {\n+\t\t\tlet result = dummy_request_str(\n+\t\t\t\tpath,\n+\t\t\t\t\"{\\\"jsonrpc\\\": \\\"2.0\\\", \\\"method\\\": \\\"say_hello\\\", \\\"params\\\": [42, 23], \\\"id\\\": 1}\",\n+\t\t\t\t);\n+\t\t\tstop_signal.send(result).unwrap();\n+\t\t}).join().unwrap();\n+\n+\t\tlet _ = stop_receiver.map(move |result: String| {\n+\t\t\tassert_eq!(\n+\t\t\t\tresult,\n+\t\t\t\t\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"result\\\":\\\"hello\\\",\\\"id\\\":1}\",\n+\t\t\t\t\"Response does not exactly match the expected response\",\n \t\t\t);\n-\n-\t\tassert_eq!(\n-\t\t\tresult,\n-\t\t\t\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"result\\\":\\\"hello\\\",\\\"id\\\":1}\",\n-\t\t\t\"Response does not exactly match the expected response\",\n-\t\t);\n-\n-\t\tthread::sleep(::std::time::Duration::from_millis(1000));\n-\t\tserver.close();\n+\t\t\tserver.close();\n+\t\t}).wait();\n \t}\n \n \t#[test]\n \tfn req_parallel() {\n-\t\tuse std::thread;\n-\n \t\t::logger::init_log();\n \t\tlet path = \"/tmp/test-ipc-45000\";\n \t\tlet server = run(path);\n-\t\tthread::sleep(::std::time::Duration::from_millis(1000));\n+\t\tthread::sleep(Duration::from_millis(100));\n+\t\tlet (stop_signal, stop_receiver) = mpsc::channel(400);\n \n \t\tlet mut handles = Vec::new();\n \t\tfor _ in 0..4 {\n \t\t\tlet path = path.clone();\n+\t\t\tlet mut stop_signal = stop_signal.clone();\n \t\t\thandles.push(\n \t\t\t\tthread::spawn(move || {\n-\t\t\t\t\tthread::sleep(::std::time::Duration::from_millis(100));\n \t\t\t\t\tfor _ in 0..100 {\n \t\t\t\t\t\tlet result = dummy_request_str(\n \t\t\t\t\t\t\t&path,\n \t\t\t\t\t\t\t\"{\\\"jsonrpc\\\": \\\"2.0\\\", \\\"method\\\": \\\"say_hello\\\", \\\"params\\\": [42, 23], \\\"id\\\": 1}\",\n \t\t\t\t\t\t\t);\n-\n-\t\t\t\t\t\tassert_eq!(\n-\t\t\t\t\t\t\tresult,\n-\t\t\t\t\t\t\t\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"result\\\":\\\"hello\\\",\\\"id\\\":1}\",\n-\t\t\t\t\t\t\t\"Response does not exactly match the expected response\",\n-\t\t\t\t\t\t\t);\n+\t\t\t\t\t\tstop_signal.try_send(result).unwrap();\n \t\t\t\t\t}\n \t\t\t\t})\n \t\t\t);\n \t\t}\n+\t\tthread::sleep(Duration::from_millis(100));","path":"ipc/src/server.rs","position":131,"original_position":102,"commit_id":"dd70e1fc4694eb425e1dc78a28214fff02be192a","original_commit_id":"dd70e1fc4694eb425e1dc78a28214fff02be192a","user":{"login":"dvdplm","id":18515,"node_id":"MDQ6VXNlcjE4NTE1","avatar_url":"https://avatars2.githubusercontent.com/u/18515?v=4","gravatar_id":"","url":"https://api.github.com/users/dvdplm","html_url":"https://github.com/dvdplm","followers_url":"https://api.github.com/users/dvdplm/followers","following_url":"https://api.github.com/users/dvdplm/following{/other_user}","gists_url":"https://api.github.com/users/dvdplm/gists{/gist_id}","starred_url":"https://api.github.com/users/dvdplm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvdplm/subscriptions","organizations_url":"https://api.github.com/users/dvdplm/orgs","repos_url":"https://api.github.com/users/dvdplm/repos","events_url":"https://api.github.com/users/dvdplm/events{/privacy}","received_events_url":"https://api.github.com/users/dvdplm/received_events","type":"User","site_admin":false},"body":"Just curious: why do we still need to nap?","created_at":"2018-06-11T12:38:54Z","updated_at":"2018-06-11T12:44:40Z","html_url":"https://github.com/paritytech/jsonrpc/pull/277#discussion_r194388305","pull_request_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments/194388305"},"html":{"href":"https://github.com/paritytech/jsonrpc/pull/277#discussion_r194388305"},"pull_request":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277"}}},"pull_request":{"url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277","id":192991979,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyOTkxOTc5","html_url":"https://github.com/paritytech/jsonrpc/pull/277","diff_url":"https://github.com/paritytech/jsonrpc/pull/277.diff","patch_url":"https://github.com/paritytech/jsonrpc/pull/277.patch","issue_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/277","number":277,"state":"open","locked":false,"title":"fixed ipc leak","user":{"login":"debris","id":2613714,"node_id":"MDQ6VXNlcjI2MTM3MTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/2613714?v=4","gravatar_id":"","url":"https://api.github.com/users/debris","html_url":"https://github.com/debris","followers_url":"https://api.github.com/users/debris/followers","following_url":"https://api.github.com/users/debris/following{/other_user}","gists_url":"https://api.github.com/users/debris/gists{/gist_id}","starred_url":"https://api.github.com/users/debris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debris/subscriptions","organizations_url":"https://api.github.com/users/debris/orgs","repos_url":"https://api.github.com/users/debris/repos","events_url":"https://api.github.com/users/debris/events{/privacy}","received_events_url":"https://api.github.com/users/debris/received_events","type":"User","site_admin":false},"body":"closes #275 \r\ncloses https://github.com/paritytech/parity/issues/8774\r\n~https://github.com/paritytech/parity/issues/8618~\r\n\r\nThe leak existed, cause we were merging incoming message responses stream with outgoing messages. If either of them existed, we were not dropping a connection.\r\n\r\nTo fix the issue, we finish the merged stream as soon as one of the merged streams ends.","created_at":"2018-06-06T12:09:10Z","updated_at":"2018-06-11T12:44:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d8f1edbbbf0e897c36fcea0eeaf140bc8b2c00e9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/commits","review_comments_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/comments","review_comment_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/277/comments","statuses_url":"https://api.github.com/repos/paritytech/jsonrpc/statuses/dd70e1fc4694eb425e1dc78a28214fff02be192a","head":{"label":"paritytech:fixed_ipc_leak","ref":"fixed_ipc_leak","sha":"dd70e1fc4694eb425e1dc78a28214fff02be192a","user":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"repo":{"id":74377848,"node_id":"MDEwOlJlcG9zaXRvcnk3NDM3Nzg0OA==","name":"jsonrpc","full_name":"paritytech/jsonrpc","owner":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paritytech/jsonrpc","description":"Rust JSON-RPC implementation","fork":false,"url":"https://api.github.com/repos/paritytech/jsonrpc","forks_url":"https://api.github.com/repos/paritytech/jsonrpc/forks","keys_url":"https://api.github.com/repos/paritytech/jsonrpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paritytech/jsonrpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paritytech/jsonrpc/teams","hooks_url":"https://api.github.com/repos/paritytech/jsonrpc/hooks","issue_events_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/events{/number}","events_url":"https://api.github.com/repos/paritytech/jsonrpc/events","assignees_url":"https://api.github.com/repos/paritytech/jsonrpc/assignees{/user}","branches_url":"https://api.github.com/repos/paritytech/jsonrpc/branches{/branch}","tags_url":"https://api.github.com/repos/paritytech/jsonrpc/tags","blobs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paritytech/jsonrpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/paritytech/jsonrpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paritytech/jsonrpc/statuses/{sha}","languages_url":"https://api.github.com/repos/paritytech/jsonrpc/languages","stargazers_url":"https://api.github.com/repos/paritytech/jsonrpc/stargazers","contributors_url":"https://api.github.com/repos/paritytech/jsonrpc/contributors","subscribers_url":"https://api.github.com/repos/paritytech/jsonrpc/subscribers","subscription_url":"https://api.github.com/repos/paritytech/jsonrpc/subscription","commits_url":"https://api.github.com/repos/paritytech/jsonrpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/paritytech/jsonrpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/paritytech/jsonrpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/paritytech/jsonrpc/contents/{+path}","compare_url":"https://api.github.com/repos/paritytech/jsonrpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paritytech/jsonrpc/merges","archive_url":"https://api.github.com/repos/paritytech/jsonrpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paritytech/jsonrpc/downloads","issues_url":"https://api.github.com/repos/paritytech/jsonrpc/issues{/number}","pulls_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls{/number}","milestones_url":"https://api.github.com/repos/paritytech/jsonrpc/milestones{/number}","notifications_url":"https://api.github.com/repos/paritytech/jsonrpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paritytech/jsonrpc/labels{/name}","releases_url":"https://api.github.com/repos/paritytech/jsonrpc/releases{/id}","deployments_url":"https://api.github.com/repos/paritytech/jsonrpc/deployments","created_at":"2016-11-21T15:32:15Z","updated_at":"2018-06-05T16:08:27Z","pushed_at":"2018-06-11T12:19:06Z","git_url":"git://github.com/paritytech/jsonrpc.git","ssh_url":"git@github.com:paritytech/jsonrpc.git","clone_url":"https://github.com/paritytech/jsonrpc.git","svn_url":"https://github.com/paritytech/jsonrpc","homepage":"","size":2402,"stargazers_count":123,"watchers_count":123,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":41,"open_issues":41,"watchers":123,"default_branch":"master"}},"base":{"label":"paritytech:master","ref":"master","sha":"3e358b48b71bf90dc60b4099de47e65b030dc319","user":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"repo":{"id":74377848,"node_id":"MDEwOlJlcG9zaXRvcnk3NDM3Nzg0OA==","name":"jsonrpc","full_name":"paritytech/jsonrpc","owner":{"login":"paritytech","id":14176906,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0MTc2OTA2","avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paritytech/jsonrpc","description":"Rust JSON-RPC implementation","fork":false,"url":"https://api.github.com/repos/paritytech/jsonrpc","forks_url":"https://api.github.com/repos/paritytech/jsonrpc/forks","keys_url":"https://api.github.com/repos/paritytech/jsonrpc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paritytech/jsonrpc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paritytech/jsonrpc/teams","hooks_url":"https://api.github.com/repos/paritytech/jsonrpc/hooks","issue_events_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/events{/number}","events_url":"https://api.github.com/repos/paritytech/jsonrpc/events","assignees_url":"https://api.github.com/repos/paritytech/jsonrpc/assignees{/user}","branches_url":"https://api.github.com/repos/paritytech/jsonrpc/branches{/branch}","tags_url":"https://api.github.com/repos/paritytech/jsonrpc/tags","blobs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paritytech/jsonrpc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paritytech/jsonrpc/git/refs{/sha}","trees_url":"https://api.github.com/repos/paritytech/jsonrpc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paritytech/jsonrpc/statuses/{sha}","languages_url":"https://api.github.com/repos/paritytech/jsonrpc/languages","stargazers_url":"https://api.github.com/repos/paritytech/jsonrpc/stargazers","contributors_url":"https://api.github.com/repos/paritytech/jsonrpc/contributors","subscribers_url":"https://api.github.com/repos/paritytech/jsonrpc/subscribers","subscription_url":"https://api.github.com/repos/paritytech/jsonrpc/subscription","commits_url":"https://api.github.com/repos/paritytech/jsonrpc/commits{/sha}","git_commits_url":"https://api.github.com/repos/paritytech/jsonrpc/git/commits{/sha}","comments_url":"https://api.github.com/repos/paritytech/jsonrpc/comments{/number}","issue_comment_url":"https://api.github.com/repos/paritytech/jsonrpc/issues/comments{/number}","contents_url":"https://api.github.com/repos/paritytech/jsonrpc/contents/{+path}","compare_url":"https://api.github.com/repos/paritytech/jsonrpc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paritytech/jsonrpc/merges","archive_url":"https://api.github.com/repos/paritytech/jsonrpc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paritytech/jsonrpc/downloads","issues_url":"https://api.github.com/repos/paritytech/jsonrpc/issues{/number}","pulls_url":"https://api.github.com/repos/paritytech/jsonrpc/pulls{/number}","milestones_url":"https://api.github.com/repos/paritytech/jsonrpc/milestones{/number}","notifications_url":"https://api.github.com/repos/paritytech/jsonrpc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paritytech/jsonrpc/labels{/name}","releases_url":"https://api.github.com/repos/paritytech/jsonrpc/releases{/id}","deployments_url":"https://api.github.com/repos/paritytech/jsonrpc/deployments","created_at":"2016-11-21T15:32:15Z","updated_at":"2018-06-05T16:08:27Z","pushed_at":"2018-06-11T12:19:06Z","git_url":"git://github.com/paritytech/jsonrpc.git","ssh_url":"git@github.com:paritytech/jsonrpc.git","clone_url":"https://github.com/paritytech/jsonrpc.git","svn_url":"https://github.com/paritytech/jsonrpc","homepage":"","size":2402,"stargazers_count":123,"watchers_count":123,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":41,"open_issues":41,"watchers":123,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277"},"html":{"href":"https://github.com/paritytech/jsonrpc/pull/277"},"issue":{"href":"https://api.github.com/repos/paritytech/jsonrpc/issues/277"},"comments":{"href":"https://api.github.com/repos/paritytech/jsonrpc/issues/277/comments"},"review_comments":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/comments"},"review_comment":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paritytech/jsonrpc/pulls/277/commits"},"statuses":{"href":"https://api.github.com/repos/paritytech/jsonrpc/statuses/dd70e1fc4694eb425e1dc78a28214fff02be192a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"dvdplm"}}