{"action":"created","comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/46856984","id":46856984,"diff_hunk":"@@ -369,55 +348,52 @@ private void start(Deque<String> commandLine) throws IOException {\n             }\n             logger.debug(\"Starting elasticsearch with {}\", startReproduction);\n             ProcessBuilder builder = new ProcessBuilder(command);\n-            builder.redirectErrorStream(true);\n+            builder.inheritIO();\n             Process process = null;\n-            String port = null;\n             String pid = null;\n-            BufferedReader stdout = null;\n             try {\n                 process = builder.start();\n-                stdout = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8));\n+                pid = getPid(pidFile);\n                 message(\"process forked\");\n-\n-                Matcher m = readUntilMatches(stdout, \"pid\", \".+\\\\[node.+ pid\\\\[(\\\\d+)\\\\].*\", timeValueSeconds(10));\n-                pid = m.group(1);\n-                message(\"pid is [\" + pid + \"]\");\n-                m = readUntilMatches(stdout, \"transport address\", \".+\\\\[transport .+bound_addresses .*\\\\{(?:127\\\\.0\\\\.0\\\\.1|\\\\[::1\\\\]):(\\\\d+)\\\\}.*\",\n-                        timeValueSeconds(20));\n-                port = m.group(1);\n-                message(\"bound to [localhost:\" + port + \"]\");\n-                readUntilMatches(stdout, \"started\", \".+\\\\] started$\", timeValueSeconds(20));\n-                runningElasticsearches.put(port, new ProcessInfo(process, pid));\n+                runningElasticsearches.put(pid, new ProcessInfo(process, pid));\n+                message(\"pid [\" + pid + \"]\");\n                 message(\"started\");\n-                process.getInputStream().close();\n             } finally {\n-                if (process != null && (port == null || !runningElasticsearches.containsKey(port))) {\n-                    logger.error(\"It looks like we failed to launch elasticsearch. Kill -9ing it just to make sure it doesn't linger.\");\n+                if (pid == null) {\n+                    logger.error(\"It looks like we failed to launch elasticsearch.\");\n                     logger.error(\"We tried to start it like this: {}\", startReproduction);\n-                    // In Java 1.8 this should be destroyForcibly\n-                    process.destroy();\n-                    if (pid != null) {\n-                        try {\n-                            new ProcessInfo(null, pid).stop();\n-                        } catch (InterruptedException e) {\n-                            logger.warn(\"Failed to stop busted elasticsearch at [{}]\", pid);\n-                        }\n+                    if (process != null) {\n+                        // In Java 1.8 this should be destroyForcibly\n+                        process.destroy();\n                     }\n-                    if (stdout != null) {\n-                        try {\n-                            stdout.reset();\n-                            CharBuffer lines = CharBuffer.allocate(1024 * 1024);\n-                            stdout.read(lines);\n-                            lines.flip();\n-                            logger.error(\n-                                    \"We were able to capture some of elasticsearch's output. Hopefully this will be useful in figuring out the failure:\\n{}\",\n-                                    lines.toString());\n-                        } catch (IOException e) {\n-                            logger.warn(\"Sadly we couldn't capture any of its output.\", e);\n-                        }\n+                }\n+            }\n+        }\n+\n+        private String getPid(String pidFile) throws IOException {\n+            Path pidPath = getPath(pidFile).toAbsolutePath();\n+            long maxTimeInMillis = 10000;\n+            long startTime = System.currentTimeMillis();\n+            while (System.currentTimeMillis() - startTime < maxTimeInMillis) {\n+                if (Files.exists(pidPath)) {\n+                    BufferedReader reader = Files.newBufferedReader(pidPath);\n+                    String pid = reader.readLine();\n+                    reader.close();\n+                    if (pid != null) {\n+                        return pid;\n                     }\n                 }\n             }\n+            throw new ElasticsearchException(\"Could not start external node, pid was not found.\");\n+        }\n+\n+        public String getPidFile(Deque<String> commandLine) {\n+            for (String param: commandLine) {\n+                if (param.contains(\"pidfile\")) {\n+                    return param.substring(13, param.length());","path":"qa/backwards/shared/src/main/java/org/elasticsearch/test/ExternalNodeService.java","position":184,"original_position":184,"commit_id":"56855773303f8acb081934a438939a8f90b57a47","original_commit_id":"56855773303f8acb081934a438939a8f90b57a47","user":{"login":"nik9000","id":215970,"avatar_url":"https://avatars.githubusercontent.com/u/215970?v=3","gravatar_id":"","url":"https://api.github.com/users/nik9000","html_url":"https://github.com/nik9000","followers_url":"https://api.github.com/users/nik9000/followers","following_url":"https://api.github.com/users/nik9000/following{/other_user}","gists_url":"https://api.github.com/users/nik9000/gists{/gist_id}","starred_url":"https://api.github.com/users/nik9000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nik9000/subscriptions","organizations_url":"https://api.github.com/users/nik9000/orgs","repos_url":"https://api.github.com/users/nik9000/repos","events_url":"https://api.github.com/users/nik9000/events{/privacy}","received_events_url":"https://api.github.com/users/nik9000/received_events","type":"User","site_admin":false},"body":"I'd prefer `param.substring(\"the 13 character string\".length());` or something like that.","created_at":"2015-12-07T18:31:17Z","updated_at":"2015-12-07T18:31:17Z","html_url":"https://github.com/elastic/elasticsearch/pull/15290#discussion_r46856984","pull_request_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290","_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments/46856984"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/15290#discussion_r46856984"},"pull_request":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290"}}},"pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290","id":52881676,"html_url":"https://github.com/elastic/elasticsearch/pull/15290","diff_url":"https://github.com/elastic/elasticsearch/pull/15290.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/15290.patch","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15290","number":15290,"state":"open","locked":false,"title":"Write log entries of external nodes to console","user":{"login":"brwe","id":4320215,"avatar_url":"https://avatars.githubusercontent.com/u/4320215?v=3","gravatar_id":"","url":"https://api.github.com/users/brwe","html_url":"https://github.com/brwe","followers_url":"https://api.github.com/users/brwe/followers","following_url":"https://api.github.com/users/brwe/following{/other_user}","gists_url":"https://api.github.com/users/brwe/gists{/gist_id}","starred_url":"https://api.github.com/users/brwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwe/subscriptions","organizations_url":"https://api.github.com/users/brwe/orgs","repos_url":"https://api.github.com/users/brwe/repos","events_url":"https://api.github.com/users/brwe/events{/privacy}","received_events_url":"https://api.github.com/users/brwe/received_events","type":"User","site_admin":false},"body":"Before external nodes wrote logs only to a file which makes it tricky to debug\r\ntest failures.\r\nThis also removes the port information which we cannot get anymore because\r\nwe do not scan the output. But is was not needed anyway.\r\n\r\nA side effect seems to be that now on windows one has to press Ctrl+C several times instead of only once to interrupt the bwc tests. Not sure how much of a problem that is. I did not find a workaround for that. \r\n\r\nIf this is too bad than we can still go for #15028","created_at":"2015-12-07T18:26:48Z","updated_at":"2015-12-07T18:31:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"31d70eaa3da9826a3f9335d84367642fc2119cec","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290/commits","review_comments_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290/comments","review_comment_url":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/15290/comments","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/56855773303f8acb081934a438939a8f90b57a47","head":{"label":"brwe:external-nodes-inherit-io","ref":"external-nodes-inherit-io","sha":"56855773303f8acb081934a438939a8f90b57a47","user":{"login":"brwe","id":4320215,"avatar_url":"https://avatars.githubusercontent.com/u/4320215?v=3","gravatar_id":"","url":"https://api.github.com/users/brwe","html_url":"https://github.com/brwe","followers_url":"https://api.github.com/users/brwe/followers","following_url":"https://api.github.com/users/brwe/following{/other_user}","gists_url":"https://api.github.com/users/brwe/gists{/gist_id}","starred_url":"https://api.github.com/users/brwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwe/subscriptions","organizations_url":"https://api.github.com/users/brwe/orgs","repos_url":"https://api.github.com/users/brwe/repos","events_url":"https://api.github.com/users/brwe/events{/privacy}","received_events_url":"https://api.github.com/users/brwe/received_events","type":"User","site_admin":false},"repo":{"id":9810286,"name":"elasticsearch","full_name":"brwe/elasticsearch","owner":{"login":"brwe","id":4320215,"avatar_url":"https://avatars.githubusercontent.com/u/4320215?v=3","gravatar_id":"","url":"https://api.github.com/users/brwe","html_url":"https://github.com/brwe","followers_url":"https://api.github.com/users/brwe/followers","following_url":"https://api.github.com/users/brwe/following{/other_user}","gists_url":"https://api.github.com/users/brwe/gists{/gist_id}","starred_url":"https://api.github.com/users/brwe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brwe/subscriptions","organizations_url":"https://api.github.com/users/brwe/orgs","repos_url":"https://api.github.com/users/brwe/repos","events_url":"https://api.github.com/users/brwe/events{/privacy}","received_events_url":"https://api.github.com/users/brwe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brwe/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":true,"url":"https://api.github.com/repos/brwe/elasticsearch","forks_url":"https://api.github.com/repos/brwe/elasticsearch/forks","keys_url":"https://api.github.com/repos/brwe/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brwe/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brwe/elasticsearch/teams","hooks_url":"https://api.github.com/repos/brwe/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/brwe/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/brwe/elasticsearch/events","assignees_url":"https://api.github.com/repos/brwe/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/brwe/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/brwe/elasticsearch/tags","blobs_url":"https://api.github.com/repos/brwe/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brwe/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brwe/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/brwe/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brwe/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/brwe/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/brwe/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/brwe/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/brwe/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/brwe/elasticsearch/subscription","commits_url":"https://api.github.com/repos/brwe/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/brwe/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/brwe/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/brwe/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/brwe/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/brwe/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brwe/elasticsearch/merges","archive_url":"https://api.github.com/repos/brwe/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brwe/elasticsearch/downloads","issues_url":"https://api.github.com/repos/brwe/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/brwe/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/brwe/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/brwe/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brwe/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/brwe/elasticsearch/releases{/id}","created_at":"2013-05-02T09:49:12Z","updated_at":"2014-08-14T12:47:29Z","pushed_at":"2015-12-07T18:20:50Z","git_url":"git://github.com/brwe/elasticsearch.git","ssh_url":"git@github.com:brwe/elasticsearch.git","clone_url":"https://github.com/brwe/elasticsearch.git","svn_url":"https://github.com/brwe/elasticsearch","homepage":"http://elasticsearch.org","size":180695,"stargazers_count":0,"watchers_count":0,"language":"Java","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":0,"default_branch":"master"}},"base":{"label":"elastic:2.x","ref":"2.x","sha":"5beb65cd8ad8d560d6d9d3443b5ee38e3f9ad760","user":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"repo":{"id":507775,"name":"elasticsearch","full_name":"elastic/elasticsearch","owner":{"login":"elastic","id":6764390,"avatar_url":"https://avatars.githubusercontent.com/u/6764390?v=3","gravatar_id":"","url":"https://api.github.com/users/elastic","html_url":"https://github.com/elastic","followers_url":"https://api.github.com/users/elastic/followers","following_url":"https://api.github.com/users/elastic/following{/other_user}","gists_url":"https://api.github.com/users/elastic/gists{/gist_id}","starred_url":"https://api.github.com/users/elastic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elastic/subscriptions","organizations_url":"https://api.github.com/users/elastic/orgs","repos_url":"https://api.github.com/users/elastic/repos","events_url":"https://api.github.com/users/elastic/events{/privacy}","received_events_url":"https://api.github.com/users/elastic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elastic/elasticsearch","description":"Open Source, Distributed, RESTful Search Engine","fork":false,"url":"https://api.github.com/repos/elastic/elasticsearch","forks_url":"https://api.github.com/repos/elastic/elasticsearch/forks","keys_url":"https://api.github.com/repos/elastic/elasticsearch/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elastic/elasticsearch/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elastic/elasticsearch/teams","hooks_url":"https://api.github.com/repos/elastic/elasticsearch/hooks","issue_events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/events{/number}","events_url":"https://api.github.com/repos/elastic/elasticsearch/events","assignees_url":"https://api.github.com/repos/elastic/elasticsearch/assignees{/user}","branches_url":"https://api.github.com/repos/elastic/elasticsearch/branches{/branch}","tags_url":"https://api.github.com/repos/elastic/elasticsearch/tags","blobs_url":"https://api.github.com/repos/elastic/elasticsearch/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elastic/elasticsearch/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elastic/elasticsearch/git/refs{/sha}","trees_url":"https://api.github.com/repos/elastic/elasticsearch/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elastic/elasticsearch/statuses/{sha}","languages_url":"https://api.github.com/repos/elastic/elasticsearch/languages","stargazers_url":"https://api.github.com/repos/elastic/elasticsearch/stargazers","contributors_url":"https://api.github.com/repos/elastic/elasticsearch/contributors","subscribers_url":"https://api.github.com/repos/elastic/elasticsearch/subscribers","subscription_url":"https://api.github.com/repos/elastic/elasticsearch/subscription","commits_url":"https://api.github.com/repos/elastic/elasticsearch/commits{/sha}","git_commits_url":"https://api.github.com/repos/elastic/elasticsearch/git/commits{/sha}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/comments{/number}","issue_comment_url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments{/number}","contents_url":"https://api.github.com/repos/elastic/elasticsearch/contents/{+path}","compare_url":"https://api.github.com/repos/elastic/elasticsearch/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elastic/elasticsearch/merges","archive_url":"https://api.github.com/repos/elastic/elasticsearch/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elastic/elasticsearch/downloads","issues_url":"https://api.github.com/repos/elastic/elasticsearch/issues{/number}","pulls_url":"https://api.github.com/repos/elastic/elasticsearch/pulls{/number}","milestones_url":"https://api.github.com/repos/elastic/elasticsearch/milestones{/number}","notifications_url":"https://api.github.com/repos/elastic/elasticsearch/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elastic/elasticsearch/labels{/name}","releases_url":"https://api.github.com/repos/elastic/elasticsearch/releases{/id}","created_at":"2010-02-08T13:20:56Z","updated_at":"2015-12-07T18:09:28Z","pushed_at":"2015-12-07T18:28:44Z","git_url":"git://github.com/elastic/elasticsearch.git","ssh_url":"git@github.com:elastic/elasticsearch.git","clone_url":"https://github.com/elastic/elasticsearch.git","svn_url":"https://github.com/elastic/elasticsearch","homepage":"https://www.elastic.co/products/elasticsearch","size":226359,"stargazers_count":13881,"watchers_count":13881,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4596,"mirror_url":null,"open_issues_count":1186,"forks":4596,"open_issues":1186,"watchers":13881,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290"},"html":{"href":"https://github.com/elastic/elasticsearch/pull/15290"},"issue":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/15290"},"comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/issues/15290/comments"},"review_comments":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290/comments"},"review_comment":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elastic/elasticsearch/pulls/15290/commits"},"statuses":{"href":"https://api.github.com/repos/elastic/elasticsearch/statuses/56855773303f8acb081934a438939a8f90b57a47"}}}}