[ https://issues.apache.org/jira/browse/METRON-1775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16612735#comment-16612735 ]
ASF GitHub Bot commented on METRON-1775: ---------------------------------------- Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/1194#discussion_r217189932 --- Diff: metron-analytics/metron-profiler/src/main/java/org/apache/metron/profiler/bolt/ProfileBuilderBolt.java --- @@ -372,15 +372,21 @@ protected void flushActive() { * that their state is not lost. */ protected void flushExpired() { + List<ProfileMeasurement> measurements = null; + try { + // flush the expired profiles + synchronized (messageDistributor) { + measurements = messageDistributor.flushExpired(); + emitMeasurements(measurements); + } - // flush the expired profiles - List<ProfileMeasurement> measurements; - synchronized (messageDistributor) { - measurements = messageDistributor.flushExpired(); - emitMeasurements(measurements); + } catch(Throwable t) { + // need to catch the exception, otherwise subsequent executions would be suppressed. + // see java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate + LOG.error("Failed to flush expired profiles", t); } - LOG.debug("Flushed expired profiles and found {} measurement(s).", measurements.size()); + LOG.debug("Flushed expired profiles and found {} measurement(s).", CollectionUtils.size(measurements)); --- End diff -- Yep, exactly. > Transient exception could prevent expired profiles from being flushed > --------------------------------------------------------------------- > > Key: METRON-1775 > URL: https://issues.apache.org/jira/browse/METRON-1775 > Project: Metron > Issue Type: Improvement > Reporter: Nick Allen > Assignee: Nick Allen > Priority: Minor > > In the Storm Profiler, the ProfileBuilderBolt uses a separate thread to flush > expired profiles. Expired profiles are those that have not received a > message for an extended period of time. That period of time is called the > profile time-to-live (profiler.ttl). This is done to avoid potential memory > leaks. > This separate thread is scheduled using > java.util.concurrent.ScheduledExecutorService#scheduleAtFixedRate. The > documentation for scheduleAtFixedRate says that if an exception is thrown, > subsequent executions will be suppressed. We do not want this to happen. If > an exception occurs, we need to log it and continue, ensuring that expired > profiles will continue to flush. > I have no direct proof that this has caused a problem, but it certainly is a > potential issue that should be addressed. -- This message was sent by Atlassian JIRA (v7.6.3#76005)