[
https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499281#comment-13499281
]
Ivan Mitic commented on HADOOP-9057:
------------------------------------
This seems to be another race condition:
{code}
ms.register("sink1", "sink1 desc", sink1);
ms.register("sink2", "sink2 desc", sink2);
ms.register("sink3", "sink3 desc", sink3); <----- ms.register() will
kick off a new MetricsSinkAdapter thread and there is no guarantee that this
thread will start on time for onTimerEvent
ms.onTimerEvent(); // trigger something interesting
{code}
To consistently repro the problem add a small sleep to MetricsSinkAdapter,
thread#run. For example:
{code}
sinkThread = new Thread() {
@Override public void run() {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
publishMetricsFromQueue();
}
};
{code}
> TestMetricsSystemImpl.testInitFirst fails intermittently
> --------------------------------------------------------
>
> Key: HADOOP-9057
> URL: https://issues.apache.org/jira/browse/HADOOP-9057
> Project: Hadoop Common
> Issue Type: Bug
> Affects Versions: 1-win
> Reporter: Ivan Mitic
> Assignee: Ivan Mitic
>
> Error Message
> Wanted but not invoked: metricsSink.putMetrics(<Capturing argument>); -> at
> org.apache.hadoop.metrics2.impl.TestMetricsSystemImpl.testInitFirst(TestMetricsSystemImpl.java:80)
> Actually, there were zero interactions with this mock.
> Stacktrace
> Wanted but not invoked:
> metricsSink.putMetrics(<Capturing argument>);
> -> at
> org.apache.hadoop.metrics2.impl.TestMetricsSystemImpl.testInitFirst(TestMetricsSystemImpl.java:80)
> Actually, there were zero interactions with this mock.
> at
> org.apache.hadoop.metrics2.impl.TestMetricsSystemImpl.testInitFirst(TestMetricsSystemImpl.java:80)
> at
> org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
> at
> org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
> Standard Output
> 2012-10-04 11:43:55,641 INFO impl.MetricsConfig
> (MetricsConfig.java:loadFirst(99)) - loaded properties from
> hadoop-metrics2-test.properties
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira