{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/5004","labels_url":"https://api.github.com/repos/apache/spark/issues/5004/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/5004/comments","events_url":"https://api.github.com/repos/apache/spark/issues/5004/events","html_url":"https://github.com/apache/spark/pull/5004","id":60863182,"number":5004,"title":"[SPARK-4012] exit JVM process when the exception is thrown from an infinite loop","user":{"login":"CodingCat","id":678008,"avatar_url":"https://avatars.githubusercontent.com/u/678008?v=3","gravatar_id":"","url":"https://api.github.com/users/CodingCat","html_url":"https://github.com/CodingCat","followers_url":"https://api.github.com/users/CodingCat/followers","following_url":"https://api.github.com/users/CodingCat/following{/other_user}","gists_url":"https://api.github.com/users/CodingCat/gists{/gist_id}","starred_url":"https://api.github.com/users/CodingCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodingCat/subscriptions","organizations_url":"https://api.github.com/users/CodingCat/orgs","repos_url":"https://api.github.com/users/CodingCat/repos","events_url":"https://api.github.com/users/CodingCat/events{/privacy}","received_events_url":"https://api.github.com/users/CodingCat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-12T17:47:10Z","updated_at":"2015-03-13T10:56:10Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/5004","html_url":"https://github.com/apache/spark/pull/5004","diff_url":"https://github.com/apache/spark/pull/5004.diff","patch_url":"https://github.com/apache/spark/pull/5004.patch"},"body":"https://issues.apache.org/jira/browse/SPARK-4012\r\n\r\nThis patch is a resubmission for https://github.com/apache/spark/pull/2864\r\n\r\nWhat I am proposing in this patch is that ***when the exception is thrown from an infinite loop, we should stop the process, instead of let JVM throws exception forever***\r\n\r\nSo, in the infinite loops where we originally wrapped with a ` logUncaughtExceptions`, I changed to `tryOrExit`, so that the JVM process is stopped\r\n\r\nEarly stopped JVM process is helpful for HA scheme design, for example, \r\n\r\nThe user has a script checking the existence of the pid of the Spark Streaming driver for monitoring the availability; with the code before this patch, the JVM process is still available but not functional when the exceptions are thrown\r\n\r\n@andrewor14, @srowen , mind taking further consideration about the change?\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/78917286","html_url":"https://github.com/apache/spark/pull/5004#issuecomment-78917286","issue_url":"https://api.github.com/repos/apache/spark/issues/5004","id":78917286,"user":{"login":"CodingCat","id":678008,"avatar_url":"https://avatars.githubusercontent.com/u/678008?v=3","gravatar_id":"","url":"https://api.github.com/users/CodingCat","html_url":"https://github.com/CodingCat","followers_url":"https://api.github.com/users/CodingCat/followers","following_url":"https://api.github.com/users/CodingCat/following{/other_user}","gists_url":"https://api.github.com/users/CodingCat/gists{/gist_id}","starred_url":"https://api.github.com/users/CodingCat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodingCat/subscriptions","organizations_url":"https://api.github.com/users/CodingCat/orgs","repos_url":"https://api.github.com/users/CodingCat/repos","events_url":"https://api.github.com/users/CodingCat/events{/privacy}","received_events_url":"https://api.github.com/users/CodingCat/received_events","type":"User","site_admin":false},"created_at":"2015-03-13T10:56:10Z","updated_at":"2015-03-13T10:56:10Z","body":"Hi, @zsxwing , `Thread.setDefaultUncaughtExceptionHandler(SparkUncaughtExceptionHandler)` is fine, though it's equivalent to the current patch in terms of functionality \r\n\r\nbut I'm not sure if we need to set exceptionHandler of all threads as SparkUncaughtExceptionHandler, because that means, once there is an uncaught exception, we stop the program...\r\n\r\n\r\n"}}