{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/comments/68986668","id":68986668,"diff_hunk":"@@ -64,14 +66,19 @@ var templates: common.Map<string> = {\n  */\n var appSettings: common.Settings;\n \n-function pipeOutput(stream: NodeJS.ReadableStream, port: number, error: boolean) {\n+function pipeOutput(server: JupyterServer, stream: NodeJS.ReadableStream, port: number, error: boolean) {\n   stream.setEncoding('utf8');\n+  var listeningMessage = `The Jupyter Notebook is running at: http://127.0.0.1:${port}`;\n+\n   stream.on('data', (data: string) => {\n     // Jupyter generates a polling kernel message once every 3 seconds\n     // per kernel! This adds too much noise into the log, so avoid\n     // logging it.\n \n     if (data.indexOf('Polling kernel') < 0) {\n+      if (data.indexOf(listeningMessage) >= 0) {","path":"sources/web/datalab/jupyter.ts","position":24,"original_position":24,"commit_id":"e45638183e64087f3cfc6276b12ed4eab9895aa7","original_commit_id":"e45638183e64087f3cfc6276b12ed4eab9895aa7","user":{"login":"ojarjur","id":3039877,"avatar_url":"https://avatars.githubusercontent.com/u/3039877?v=3","gravatar_id":"","url":"https://api.github.com/users/ojarjur","html_url":"https://github.com/ojarjur","followers_url":"https://api.github.com/users/ojarjur/followers","following_url":"https://api.github.com/users/ojarjur/following{/other_user}","gists_url":"https://api.github.com/users/ojarjur/gists{/gist_id}","starred_url":"https://api.github.com/users/ojarjur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojarjur/subscriptions","organizations_url":"https://api.github.com/users/ojarjur/orgs","repos_url":"https://api.github.com/users/ojarjur/repos","events_url":"https://api.github.com/users/ojarjur/events{/privacy}","received_events_url":"https://api.github.com/users/ojarjur/received_events","type":"User","site_admin":false},"body":"No, I don't think this can be removed. This is arguably the most important safeguard that is being added.\r\n\r\nSpecifically, this check ensures that we do not send any traffic to the proxy until after we confirm that the proxy is pointing at the Jupyter server we think it is.","created_at":"2016-06-29T17:05:14Z","updated_at":"2016-06-29T17:05:14Z","html_url":"https://github.com/GoogleCloudPlatform/datalab/pull/885#discussion_r68986668","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/comments/68986668"},"html":{"href":"https://github.com/GoogleCloudPlatform/datalab/pull/885#discussion_r68986668"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885","id":75565241,"html_url":"https://github.com/GoogleCloudPlatform/datalab/pull/885","diff_url":"https://github.com/GoogleCloudPlatform/datalab/pull/885.diff","patch_url":"https://github.com/GoogleCloudPlatform/datalab/pull/885.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/885","number":885,"state":"open","locked":false,"title":"Fix a bug in the port selection for the nested Jupyter servers.","user":{"login":"ojarjur","id":3039877,"avatar_url":"https://avatars.githubusercontent.com/u/3039877?v=3","gravatar_id":"","url":"https://api.github.com/users/ojarjur","html_url":"https://github.com/ojarjur","followers_url":"https://api.github.com/users/ojarjur/followers","following_url":"https://api.github.com/users/ojarjur/following{/other_user}","gists_url":"https://api.github.com/users/ojarjur/gists{/gist_id}","starred_url":"https://api.github.com/users/ojarjur/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ojarjur/subscriptions","organizations_url":"https://api.github.com/users/ojarjur/orgs","repos_url":"https://api.github.com/users/ojarjur/repos","events_url":"https://api.github.com/users/ojarjur/events{/privacy}","received_events_url":"https://api.github.com/users/ojarjur/received_events","type":"User","site_admin":false},"body":"Previously, Datalab was picking the next port that it wanted Jupyter\r\nto run on, passing that to the launched Jupyter process using the\r\n'--port' flag, and then assuming that the server did in fact start\r\nlistening on that port.\r\n\r\nHowever, if the port selected was already in use, then Jupyter would\r\nautomatically try the next port in sequence. That could cause an issue\r\nwhere the one Jupyter server (for one user) was listening on a port\r\nthat we thought was being used by the Jupyter server for a different\r\nuser.\r\n\r\nThis change fixes that bug by doing the following:\r\n\r\n1. Verifying that the next port is free before we try to start a\r\n   Jupyter server listening on it.\r\n2. Telling the Jupyter server to not try any additional ports if\r\n   the one specified was not available (so it will instead die in\r\n   that situation).\r\n3. Waiting until the Jupyter server has reported that it is\r\n   listening on that port before invoking the user callbacks.\r\n\r\nThe combination of these two steps effectively moves the retry\r\nlogic for picking a port out of the Jupyter process and in to the\r\nwrapping Node server.\r\n\r\nThere is still one failure case that can manifest even with this\r\nchange. Specifically, if the attempt to start a Jupyter server\r\nfails more than 10 times, then the retry logic will give up and\r\nan internal error will be reported to the user.\r\n\r\nThis failure mode always existed, but now we will be properly\r\ntracking it.\r\n\r\nWe believe that this will fix #884 ","created_at":"2016-06-28T23:08:29Z","updated_at":"2016-06-29T17:05:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7bdd7a713350f27ddbbf5855e7cfca96ebe924b4","assignee":{"login":"qimingj","id":13439553,"avatar_url":"https://avatars.githubusercontent.com/u/13439553?v=3","gravatar_id":"","url":"https://api.github.com/users/qimingj","html_url":"https://github.com/qimingj","followers_url":"https://api.github.com/users/qimingj/followers","following_url":"https://api.github.com/users/qimingj/following{/other_user}","gists_url":"https://api.github.com/users/qimingj/gists{/gist_id}","starred_url":"https://api.github.com/users/qimingj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qimingj/subscriptions","organizations_url":"https://api.github.com/users/qimingj/orgs","repos_url":"https://api.github.com/users/qimingj/repos","events_url":"https://api.github.com/users/qimingj/events{/privacy}","received_events_url":"https://api.github.com/users/qimingj/received_events","type":"User","site_admin":false},"assignees":[{"login":"qimingj","id":13439553,"avatar_url":"https://avatars.githubusercontent.com/u/13439553?v=3","gravatar_id":"","url":"https://api.github.com/users/qimingj","html_url":"https://github.com/qimingj","followers_url":"https://api.github.com/users/qimingj/followers","following_url":"https://api.github.com/users/qimingj/following{/other_user}","gists_url":"https://api.github.com/users/qimingj/gists{/gist_id}","starred_url":"https://api.github.com/users/qimingj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/qimingj/subscriptions","organizations_url":"https://api.github.com/users/qimingj/orgs","repos_url":"https://api.github.com/users/qimingj/repos","events_url":"https://api.github.com/users/qimingj/events{/privacy}","received_events_url":"https://api.github.com/users/qimingj/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/885/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/statuses/e45638183e64087f3cfc6276b12ed4eab9895aa7","head":{"label":"GoogleCloudPlatform:ojarjur/fix-jupyter-ports","ref":"ojarjur/fix-jupyter-ports","sha":"e45638183e64087f3cfc6276b12ed4eab9895aa7","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":22693761,"name":"datalab","full_name":"GoogleCloudPlatform/datalab","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/datalab","description":"Interactive tools and developer experiences for Big Data on Google Cloud Platform.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/datalab","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/deployments","created_at":"2014-08-06T18:37:34Z","updated_at":"2016-06-26T20:23:59Z","pushed_at":"2016-06-29T01:42:27Z","git_url":"git://github.com/GoogleCloudPlatform/datalab.git","ssh_url":"git@github.com:GoogleCloudPlatform/datalab.git","clone_url":"https://github.com/GoogleCloudPlatform/datalab.git","svn_url":"https://github.com/GoogleCloudPlatform/datalab","homepage":"","size":184948,"stargazers_count":272,"watchers_count":272,"language":"Jupyter Notebook","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":63,"mirror_url":null,"open_issues_count":116,"forks":63,"open_issues":116,"watchers":272,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"0cf13ae37ee44da0e4c512e764066892a6fd8bd4","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":22693761,"name":"datalab","full_name":"GoogleCloudPlatform/datalab","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/datalab","description":"Interactive tools and developer experiences for Big Data on Google Cloud Platform.","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/datalab","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/datalab/deployments","created_at":"2014-08-06T18:37:34Z","updated_at":"2016-06-26T20:23:59Z","pushed_at":"2016-06-29T01:42:27Z","git_url":"git://github.com/GoogleCloudPlatform/datalab.git","ssh_url":"git@github.com:GoogleCloudPlatform/datalab.git","clone_url":"https://github.com/GoogleCloudPlatform/datalab.git","svn_url":"https://github.com/GoogleCloudPlatform/datalab","homepage":"","size":184948,"stargazers_count":272,"watchers_count":272,"language":"Jupyter Notebook","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":63,"mirror_url":null,"open_issues_count":116,"forks":63,"open_issues":116,"watchers":272,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885"},"html":{"href":"https://github.com/GoogleCloudPlatform/datalab/pull/885"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/885"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/issues/885/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/pulls/885/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/datalab/statuses/e45638183e64087f3cfc6276b12ed4eab9895aa7"}}}}
{"actor":{"display_login":"ojarjur"}}