You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Ivan Mitic (JIRA)" <ji...@apache.org> on 2012/11/17 01:35:13 UTC
[jira] [Created] (HADOOP-9057) TestMetricsSystemImpl.testInitFirst
fails intermittently
Ivan Mitic created HADOOP-9057:
----------------------------------
Summary: 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13503677#comment-13503677 ]
Ivan Mitic commented on HADOOP-9057:
------------------------------------
Thanks Mostafa for the comment. If we don't want to change the semantic of the test, we will want to sleep before MetricsSink#stop, otherwise, the event might be lost. Both approaches boil down to the same outcome though, we end up sleeping for a while.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Updated] (HADOOP-9057) TestMetricsSystemImpl.testInitFirst
fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Mitic updated HADOOP-9057:
-------------------------------
Attachment: HADOOP-9057.branch-1-win.metricsrace.patch
Attaching a proposal for a fix. It's not an ideal fix but it does mitigate the problem.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499624#comment-13499624 ]
Ivan Mitic commented on HADOOP-9057:
------------------------------------
HDFS-3636 reports the same issue. One of the two should be resolved as duplicate.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Hadoop QA (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13499288#comment-13499288 ]
Hadoop QA commented on HADOOP-9057:
-----------------------------------
{color:red}-1 overall{color}. Here are the results of testing the latest attachment
http://issues.apache.org/jira/secure/attachment/12553872/HADOOP-9057.branch-1-win.metricsrace.patch
against trunk revision .
{color:red}-1 patch{color}. The patch command could not apply the patch.
Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/1767//console
This message is automatically generated.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Mostafa Elhemali (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13503334#comment-13503334 ]
Mostafa Elhemali commented on HADOOP-9057:
------------------------------------------
Instead of sleeping for a second, would the timeout() method from mockito help?
{{verify(sink1, timeout(1000).times(2)).putMetrics(r1.capture());}}
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Luke Lu (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13506103#comment-13506103 ]
Luke Lu commented on HADOOP-9057:
---------------------------------
Mostafa: the timeout in mockito verify is a good idea. If you can provide trunk patch and branch-1 patches, I'll commit them.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Updated] (HADOOP-9057) TestMetricsSystemImpl.testInitFirst
fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Mitic updated HADOOP-9057:
-------------------------------
Resolution: Duplicate
Status: Resolved (was: Patch Available)
Duplicate of HADOOP-8981.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Xuan Gong (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13507645#comment-13507645 ]
Xuan Gong commented on HADOOP-9057:
-----------------------------------
The timeout in mockito verify is a great idea. It actually verify the callback before we call the stop function.
But I think that we may need add another test case to verify the stop(). I think that the purpose of this stop() is when I call this function, all the sink threads should stop no matter they are idle or they are doing something.
And actually the test is fail, on the other side, it proved that our stop function is actually worked correctly. When we call the stop, everything is stopped no matter what they are doing right now. Based on that, I runned this test several times, I found that sometimes it will be successful, sometimes half rigth half wrong, sometimes all fails.
That is why orignally we try to add Thread.sleep() and try to buy some times for the sink threads to consume all the items in queue.
Maybe you can take a look at the HADOOP-8981, this is the duplication issue. I uploaded patches verion 3, including the test case that using the mockito timeout and another test case to verify stop function.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13507697#comment-13507697 ]
Ivan Mitic commented on HADOOP-9057:
------------------------------------
Thanks Xuan for posting the patch. I will take a look on the other Jira. Will resolve this one as a duplicate and we can backport from the other one.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Commented] (HADOOP-9057)
TestMetricsSystemImpl.testInitFirst fails intermittently
Posted by "Mostafa Elhemali (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13503933#comment-13503933 ]
Mostafa Elhemali commented on HADOOP-9057:
------------------------------------------
Ah good point about needing to do it before the close. Would something like this work?
{{
try {
verify(sink1, timeout(1000).times(2)).putMetrics(r1.capture());
} finally {
ms.close();
}
}}
The reason I'm pushing for timeout() instead of straight-up sleep() is that timeout() is smart enough to finish early (it will wake up when it gets the required two calls), whereas with the sleep() approach we unnecessarily waste a second in this one test. A second may not seem like much, but it adds up in thousands of tests.
Another approach is to use latches in the sinks, but that seems too involved for no reason. Anyway, my votes/comments here are non-binding - just my 2 cents.
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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
[jira] [Updated] (HADOOP-9057) TestMetricsSystemImpl.testInitFirst
fails intermittently
Posted by "Ivan Mitic (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/HADOOP-9057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Mitic updated HADOOP-9057:
-------------------------------
Status: Patch Available (was: Open)
> 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
> Attachments: HADOOP-9057.branch-1-win.metricsrace.patch
>
>
> 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