[ 
https://issues.apache.org/jira/browse/HADOOP-4969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12660768#action_12660768
 ] 

Steve Loughran commented on HADOOP-4969:
----------------------------------------

I dont think JVM shutdown is an action that should be taken by a handler, as it 
is making assumptions about how the process is running that may not always 
hold. It will certainly make a mess of JUnit tests, for example.


How about we identify wherever threads get used and make sure that exceptions 
get caught and reported. In my codebase we have replaced Runnable with an 
interface that throws things


public interface Executable {
    void execute() throws Throwable;
}


There is a matching thread class that implements this and calls any 
implementation it is bonded to; threads are caught and a notification object 
called. This lets us catch everything and listen for problems. 

    public void run() {
        try {
            execute();
        } catch (Throwable throwable) {
            setThrown(throwable);
        } finally {
            synchronized (notifyObject) {
                //set the finished bit
                finished = true;
                //notify any waiters
                notifyObject.notifyAll();
            }
        }
    }

If the services aren't catching failures, it also means they are probably 
leaking threads. Not good for extended use. 

I'd be happier with 
* something like the code above
* every thread to have a useful toString() override
* the UncaughtExceptionHandler only logs the uncaught exception at ERROR level, 
with the relevant toString(). The error message should tell the viewer to log a 
bugrep on apache jira

Alternatively: use the java5 concurrency stuff instead of threads. 

> Threads in servers should not die silently.
> -------------------------------------------
>
>                 Key: HADOOP-4969
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4969
>             Project: Hadoop Core
>          Issue Type: Improvement
>          Components: dfs
>            Reporter: Tsz Wo (Nicholas), SZE
>
> If there is an uncaught exception, some threads in a server may die silently. 
> The corresponding error message does not show up in the log.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to