You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@storm.apache.org by "Jungtaek Lim (JIRA)" <ji...@apache.org> on 2017/12/27 02:10:04 UTC

[jira] [Created] (STORM-2870) FileBasedEventLogger leaks non-daemon ExecutorService which prevents process to be finished

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)