[
https://issues.apache.org/jira/browse/STORM-712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14383262#comment-14383262
]
ASF GitHub Bot commented on STORM-712:
--------------------------------------
Github user longdafeng commented on a diff in the pull request:
https://github.com/apache/storm/pull/468#discussion_r27273285
--- Diff: storm-core/src/jvm/backtype/storm/utils/Utils.java ---
@@ -533,4 +533,16 @@ private static SerializationDelegate
getSerializationDelegate(Map stormConf) {
delegate.prepare(stormConf);
return delegate;
}
+
+ public static void handleUncaughtException(Throwable t) {
+ if(t!= null && t instanceof OutOfMemoryError) {
+ try {
+ System.err.println("Halting due to Out Of Memory Error..." +
Thread.currentThread().getName());
+ } catch (Throwable err) {
+ //Again we done want to exit because of logging issues.
+ }
+ Runtime.getRuntime().halt(-1);
+ }
+ }
--- End diff --
Please don't use "System.err.println", it is likely to lose all
System.out/err message when start storm like "nohup storm nimbus >/dev/null
2>&1 &"
it is better use log interface.
> Storm daemons must shutdown JVM in case of OOM in any thread
> ------------------------------------------------------------
>
> Key: STORM-712
> URL: https://issues.apache.org/jira/browse/STORM-712
> Project: Apache Storm
> Issue Type: Improvement
> Reporter: Kishor Patil
>
> In case of OutOfMemoryError in any thread, it needs to trigger immediate
> shutdown of the server. I can be done by using
> setDefaultUncaughtExceptionHandler on threads being created.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)