Jungtaek Lim created STORM-2870:
-----------------------------------

             Summary: FileBasedEventLogger leaks non-daemon ExecutorService 
which prevents process to be finished
                 Key: STORM-2870
                 URL: https://issues.apache.org/jira/browse/STORM-2870
             Project: Apache Storm
          Issue Type: Bug
          Components: storm-core
    Affects Versions: 2.0.0, 1.2.0, 1.1.2, 1.0.6
            Reporter: Jungtaek Lim
            Assignee: Jungtaek Lim


{code}
    private void setUpFlushTask() {
        ScheduledExecutorService scheduler = 
Executors.newSingleThreadScheduledExecutor();
        Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    if(dirty) {
                        eventLogWriter.flush();
                        dirty = false;
                    }
                } catch (IOException ex) {
                    LOG.error("Error flushing " + eventLogPath, ex);
                    throw new RuntimeException(ex);
                }
            }
        };

        scheduler.scheduleAtFixedRate(task, FLUSH_INTERVAL_MILLIS, 
FLUSH_INTERVAL_MILLIS, TimeUnit.MILLISECONDS);
}
{code}

The code block initializes ExecutorService locally, which served threads are 
not daemons so it can prevent JVM to be exit successfully.

Moreover it should be considered as bad case: not labeling thread name. I 
observed the process hung and got jstack, but hard to know where is the root, 
because leaked thread has default thread name.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to