{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/27353652","id":27353652,"diff_hunk":"@@ -62,22 +63,15 @@ private[spark] class ShuffleMapTask(\n \n     metrics = Some(context.taskMetrics)\n     var writer: ShuffleWriter[Any, Any] = null\n-    try {\n+    Utils.tryWithSafeFinally {\n       val manager = SparkEnv.get.shuffleManager\n       writer = manager.getWriter[Any, Any](dep.shuffleHandle, partitionId, context)\n       writer.write(rdd.iterator(partition, context).asInstanceOf[Iterator[_ <: Product2[Any, Any]]])\n       return writer.stop(success = true).get\n-    } catch {\n-      case e: Exception =>\n-        try {\n-          if (writer != null) {\n-            writer.stop(success = false)\n-          }\n-        } catch {\n-          case e: Exception =>\n-            log.debug(\"Could not stop writer\", e)\n-        }\n-        throw e\n+    } {","path":"core/src/main/scala/org/apache/spark/scheduler/ShuffleMapTask.scala","position":29,"original_position":29,"commit_id":"d7949a39377cb679ca6acbc03a7ff7475ae213bb","original_commit_id":"d7949a39377cb679ca6acbc03a7ff7475ae213bb","user":{"login":"srowen","id":822522,"avatar_url":"https://avatars.githubusercontent.com/u/822522?v=3","gravatar_id":"","url":"https://api.github.com/users/srowen","html_url":"https://github.com/srowen","followers_url":"https://api.github.com/users/srowen/followers","following_url":"https://api.github.com/users/srowen/following{/other_user}","gists_url":"https://api.github.com/users/srowen/gists{/gist_id}","starred_url":"https://api.github.com/users/srowen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srowen/subscriptions","organizations_url":"https://api.github.com/users/srowen/orgs","repos_url":"https://api.github.com/users/srowen/repos","events_url":"https://api.github.com/users/srowen/events{/privacy}","received_events_url":"https://api.github.com/users/srowen/received_events","type":"User","site_admin":false},"body":"The code was not closing the writer before during normal execution, so this is good. However, this change also means that it will stop with success = false whether an error occurred or not, and will do so even after stop was called with success = true. This one may not fit the pattern.","created_at":"2015-03-29T11:26:35Z","updated_at":"2015-03-29T11:26:35Z","html_url":"https://github.com/apache/spark/pull/5223#discussion_r27353652","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/5223","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/27353652"},"html":{"href":"https://github.com/apache/spark/pull/5223#discussion_r27353652"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/5223"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5223","id":32082303,"html_url":"https://github.com/apache/spark/pull/5223","diff_url":"https://github.com/apache/spark/pull/5223.diff","patch_url":"https://github.com/apache/spark/pull/5223.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/5223","number":5223,"state":"open","locked":false,"title":"[SPARK-6560][CORE] Do not suppress exceptions from writer.write.","user":{"login":"stephenh","id":6401,"avatar_url":"https://avatars.githubusercontent.com/u/6401?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenh","html_url":"https://github.com/stephenh","followers_url":"https://api.github.com/users/stephenh/followers","following_url":"https://api.github.com/users/stephenh/following{/other_user}","gists_url":"https://api.github.com/users/stephenh/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenh/subscriptions","organizations_url":"https://api.github.com/users/stephenh/orgs","repos_url":"https://api.github.com/users/stephenh/repos","events_url":"https://api.github.com/users/stephenh/events{/privacy}","received_events_url":"https://api.github.com/users/stephenh/received_events","type":"User","site_admin":false},"body":"If there is a failure in the Hadoop backend while calling\r\nwriter.write, we should remember this original exception,\r\nand try to call writer.close(), but if that fails as well,\r\nstill report the original exception.\r\n\r\nNote that, if writer.write fails, it is likely that writer\r\nwas left in an invalid state, and so actually makes it more\r\nlikely that writer.close will also fail. Which just increases\r\nthe chances for writer.write's exception to be suppressed.\r\n\r\nThis patch introduces an admittedly potentially too cute\r\nUtils.tryWithSafeFinally method to handle the try/finally\r\ngyrations.","created_at":"2015-03-27T04:16:58Z","updated_at":"2015-03-29T11:26:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92a30de673071c236c1051bfdd03c013dede67e2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/5223/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/5223/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/5223/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/d7949a39377cb679ca6acbc03a7ff7475ae213bb","head":{"label":"stephenh:do_not_suppress_writer_exception","ref":"do_not_suppress_writer_exception","sha":"d7949a39377cb679ca6acbc03a7ff7475ae213bb","user":{"login":"stephenh","id":6401,"avatar_url":"https://avatars.githubusercontent.com/u/6401?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenh","html_url":"https://github.com/stephenh","followers_url":"https://api.github.com/users/stephenh/followers","following_url":"https://api.github.com/users/stephenh/following{/other_user}","gists_url":"https://api.github.com/users/stephenh/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenh/subscriptions","organizations_url":"https://api.github.com/users/stephenh/orgs","repos_url":"https://api.github.com/users/stephenh/repos","events_url":"https://api.github.com/users/stephenh/events{/privacy}","received_events_url":"https://api.github.com/users/stephenh/received_events","type":"User","site_admin":false},"repo":{"id":27306528,"name":"spark","full_name":"stephenh/spark","owner":{"login":"stephenh","id":6401,"avatar_url":"https://avatars.githubusercontent.com/u/6401?v=3","gravatar_id":"","url":"https://api.github.com/users/stephenh","html_url":"https://github.com/stephenh","followers_url":"https://api.github.com/users/stephenh/followers","following_url":"https://api.github.com/users/stephenh/following{/other_user}","gists_url":"https://api.github.com/users/stephenh/gists{/gist_id}","starred_url":"https://api.github.com/users/stephenh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephenh/subscriptions","organizations_url":"https://api.github.com/users/stephenh/orgs","repos_url":"https://api.github.com/users/stephenh/repos","events_url":"https://api.github.com/users/stephenh/events{/privacy}","received_events_url":"https://api.github.com/users/stephenh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stephenh/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/stephenh/spark","forks_url":"https://api.github.com/repos/stephenh/spark/forks","keys_url":"https://api.github.com/repos/stephenh/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stephenh/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stephenh/spark/teams","hooks_url":"https://api.github.com/repos/stephenh/spark/hooks","issue_events_url":"https://api.github.com/repos/stephenh/spark/issues/events{/number}","events_url":"https://api.github.com/repos/stephenh/spark/events","assignees_url":"https://api.github.com/repos/stephenh/spark/assignees{/user}","branches_url":"https://api.github.com/repos/stephenh/spark/branches{/branch}","tags_url":"https://api.github.com/repos/stephenh/spark/tags","blobs_url":"https://api.github.com/repos/stephenh/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stephenh/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stephenh/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/stephenh/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stephenh/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/stephenh/spark/languages","stargazers_url":"https://api.github.com/repos/stephenh/spark/stargazers","contributors_url":"https://api.github.com/repos/stephenh/spark/contributors","subscribers_url":"https://api.github.com/repos/stephenh/spark/subscribers","subscription_url":"https://api.github.com/repos/stephenh/spark/subscription","commits_url":"https://api.github.com/repos/stephenh/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/stephenh/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/stephenh/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/stephenh/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/stephenh/spark/contents/{+path}","compare_url":"https://api.github.com/repos/stephenh/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stephenh/spark/merges","archive_url":"https://api.github.com/repos/stephenh/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stephenh/spark/downloads","issues_url":"https://api.github.com/repos/stephenh/spark/issues{/number}","pulls_url":"https://api.github.com/repos/stephenh/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/stephenh/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/stephenh/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stephenh/spark/labels{/name}","releases_url":"https://api.github.com/repos/stephenh/spark/releases{/id}","created_at":"2014-11-29T15:42:04Z","updated_at":"2015-02-04T14:50:43Z","pushed_at":"2015-03-28T23:02:59Z","git_url":"git://github.com/stephenh/spark.git","ssh_url":"git@github.com:stephenh/spark.git","clone_url":"https://github.com/stephenh/spark.git","svn_url":"https://github.com/stephenh/spark","homepage":null,"size":95547,"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":"f75f633b21faaf911f04aeff847f25749b1ecd89","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-03-29T08:19:11Z","pushed_at":"2015-03-29T10:58:40Z","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":1448314,"stargazers_count":3396,"watchers_count":3396,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2938,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":303,"forks":2938,"open_issues":303,"watchers":3396,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/5223"},"html":{"href":"https://github.com/apache/spark/pull/5223"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/5223"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/5223/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/5223/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/5223/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/d7949a39377cb679ca6acbc03a7ff7475ae213bb"}}}}