{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/28995720","id":28995720,"diff_hunk":"@@ -177,102 +177,108 @@ object GradientBoostedTrees extends Logging {\n     treeStrategy.assertValid()\n \n     // Cache input\n-    if (input.getStorageLevel == StorageLevel.NONE) {\n+    val persistedInput = if (input.getStorageLevel == StorageLevel.NONE) {\n       input.persist(StorageLevel.MEMORY_AND_DISK)\n-    }\n+      true\n+    } else false\n \n-    timer.stop(\"init\")\n+    try {","path":"mllib/src/main/scala/org/apache/spark/mllib/tree/GradientBoostedTrees.scala","position":12,"original_position":12,"commit_id":"e5be57c925f371edb96edbe7385cf62ebd9d575f","original_commit_id":"e5be57c925f371edb96edbe7385cf62ebd9d575f","user":{"login":"jimfcarroll","id":372696,"avatar_url":"https://avatars.githubusercontent.com/u/372696?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfcarroll","html_url":"https://github.com/jimfcarroll","followers_url":"https://api.github.com/users/jimfcarroll/followers","following_url":"https://api.github.com/users/jimfcarroll/following{/other_user}","gists_url":"https://api.github.com/users/jimfcarroll/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfcarroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfcarroll/subscriptions","organizations_url":"https://api.github.com/users/jimfcarroll/orgs","repos_url":"https://api.github.com/users/jimfcarroll/repos","events_url":"https://api.github.com/users/jimfcarroll/events{/privacy}","received_events_url":"https://api.github.com/users/jimfcarroll/received_events","type":"User","site_admin":false},"body":"I override and intercept most RDD calls in my own code to optimize them (which is how I found this in the first place) and we use try-with-resource to persist and unpersist. It's too bad you cant do that simply in scala.\r\n\r\nIf you want the simpler solution let me know. I can change it.","created_at":"2015-04-23T19:37:03Z","updated_at":"2015-04-23T19:37:03Z","html_url":"https://github.com/apache/spark/pull/5669#discussion_r28995720","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/5669","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/28995720"},"html":{"href":"https://github.com/apache/spark/pull/5669#discussion_r28995720"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/5669"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5669","id":33987572,"html_url":"https://github.com/apache/spark/pull/5669","diff_url":"https://github.com/apache/spark/pull/5669.diff","patch_url":"https://github.com/apache/spark/pull/5669.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/5669","number":5669,"state":"open","locked":false,"title":"[SPARK-7100][MLLib] Fix persisted RDD leak in GradientBoostTrees","user":{"login":"jimfcarroll","id":372696,"avatar_url":"https://avatars.githubusercontent.com/u/372696?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfcarroll","html_url":"https://github.com/jimfcarroll","followers_url":"https://api.github.com/users/jimfcarroll/followers","following_url":"https://api.github.com/users/jimfcarroll/following{/other_user}","gists_url":"https://api.github.com/users/jimfcarroll/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfcarroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfcarroll/subscriptions","organizations_url":"https://api.github.com/users/jimfcarroll/orgs","repos_url":"https://api.github.com/users/jimfcarroll/repos","events_url":"https://api.github.com/users/jimfcarroll/events{/privacy}","received_events_url":"https://api.github.com/users/jimfcarroll/received_events","type":"User","site_admin":false},"body":"This fixes a leak of a persisted RDD where GradientBoostTrees can call persist but never unpersists.\r\n\r\nJira: https://issues.apache.org/jira/browse/SPARK-7100\r\n\r\nDiscussion: http://apache-spark-developers-list.1001551.n3.nabble.com/GradientBoostTrees-leaks-a-persisted-RDD-td11750.html\r\n","created_at":"2015-04-23T19:21:09Z","updated_at":"2015-04-23T19:37:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"abd82755c1e8a5d3be26e138c33119c5b0106a98","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/5669/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/5669/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/5669/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/e5be57c925f371edb96edbe7385cf62ebd9d575f","head":{"label":"jimfcarroll:gb-unpersist-fix","ref":"gb-unpersist-fix","sha":"e5be57c925f371edb96edbe7385cf62ebd9d575f","user":{"login":"jimfcarroll","id":372696,"avatar_url":"https://avatars.githubusercontent.com/u/372696?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfcarroll","html_url":"https://github.com/jimfcarroll","followers_url":"https://api.github.com/users/jimfcarroll/followers","following_url":"https://api.github.com/users/jimfcarroll/following{/other_user}","gists_url":"https://api.github.com/users/jimfcarroll/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfcarroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfcarroll/subscriptions","organizations_url":"https://api.github.com/users/jimfcarroll/orgs","repos_url":"https://api.github.com/users/jimfcarroll/repos","events_url":"https://api.github.com/users/jimfcarroll/events{/privacy}","received_events_url":"https://api.github.com/users/jimfcarroll/received_events","type":"User","site_admin":false},"repo":{"id":26605852,"name":"spark","full_name":"jimfcarroll/spark","owner":{"login":"jimfcarroll","id":372696,"avatar_url":"https://avatars.githubusercontent.com/u/372696?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfcarroll","html_url":"https://github.com/jimfcarroll","followers_url":"https://api.github.com/users/jimfcarroll/followers","following_url":"https://api.github.com/users/jimfcarroll/following{/other_user}","gists_url":"https://api.github.com/users/jimfcarroll/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfcarroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfcarroll/subscriptions","organizations_url":"https://api.github.com/users/jimfcarroll/orgs","repos_url":"https://api.github.com/users/jimfcarroll/repos","events_url":"https://api.github.com/users/jimfcarroll/events{/privacy}","received_events_url":"https://api.github.com/users/jimfcarroll/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimfcarroll/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/jimfcarroll/spark","forks_url":"https://api.github.com/repos/jimfcarroll/spark/forks","keys_url":"https://api.github.com/repos/jimfcarroll/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimfcarroll/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimfcarroll/spark/teams","hooks_url":"https://api.github.com/repos/jimfcarroll/spark/hooks","issue_events_url":"https://api.github.com/repos/jimfcarroll/spark/issues/events{/number}","events_url":"https://api.github.com/repos/jimfcarroll/spark/events","assignees_url":"https://api.github.com/repos/jimfcarroll/spark/assignees{/user}","branches_url":"https://api.github.com/repos/jimfcarroll/spark/branches{/branch}","tags_url":"https://api.github.com/repos/jimfcarroll/spark/tags","blobs_url":"https://api.github.com/repos/jimfcarroll/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimfcarroll/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimfcarroll/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimfcarroll/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimfcarroll/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/jimfcarroll/spark/languages","stargazers_url":"https://api.github.com/repos/jimfcarroll/spark/stargazers","contributors_url":"https://api.github.com/repos/jimfcarroll/spark/contributors","subscribers_url":"https://api.github.com/repos/jimfcarroll/spark/subscribers","subscription_url":"https://api.github.com/repos/jimfcarroll/spark/subscription","commits_url":"https://api.github.com/repos/jimfcarroll/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimfcarroll/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimfcarroll/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimfcarroll/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimfcarroll/spark/contents/{+path}","compare_url":"https://api.github.com/repos/jimfcarroll/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimfcarroll/spark/merges","archive_url":"https://api.github.com/repos/jimfcarroll/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimfcarroll/spark/downloads","issues_url":"https://api.github.com/repos/jimfcarroll/spark/issues{/number}","pulls_url":"https://api.github.com/repos/jimfcarroll/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/jimfcarroll/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/jimfcarroll/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimfcarroll/spark/labels{/name}","releases_url":"https://api.github.com/repos/jimfcarroll/spark/releases{/id}","created_at":"2014-11-13T20:12:38Z","updated_at":"2015-04-23T14:58:28Z","pushed_at":"2015-04-23T19:18:43Z","git_url":"git://github.com/jimfcarroll/spark.git","ssh_url":"git@github.com:jimfcarroll/spark.git","clone_url":"https://github.com/jimfcarroll/spark.git","svn_url":"https://github.com/jimfcarroll/spark","homepage":null,"size":98713,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"apache:master","ref":"master","sha":"c1213e6a92e126ad886d9804cedaf6db3618e602","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","created_at":"2014-02-25T08:00:08Z","updated_at":"2015-04-23T19:00:42Z","pushed_at":"2015-04-23T19:21:09Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":1534655,"stargazers_count":3718,"watchers_count":3718,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3238,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":305,"forks":3238,"open_issues":305,"watchers":3718,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/5669"},"html":{"href":"https://github.com/apache/spark/pull/5669"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/5669"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/5669/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/5669/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/5669/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/e5be57c925f371edb96edbe7385cf62ebd9d575f"}}}}