You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "George Huang (Jira)" <ji...@apache.org> on 2021/12/02 00:39:00 UTC

[jira] [Commented] (HDDS-6060) ERROR MetricsSourceAdapter: Error getting metrics from source SCMContainerMetrics java.util.ConcurrentModificationException

    [ https://issues.apache.org/jira/browse/HDDS-6060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17452098#comment-17452098 ] 

George Huang commented on HDDS-6060:
------------------------------------

From @Bharat Viswanadham, 

I think what might be happening here is

The containerID's set which we get is UnModifiableNavigableSet wrapping original NavigableSet, so the returned object cannot be modified by caller, but other threads can modify this while map phase happening(during collect). So, ContainerAttribute#getCollection need to return a NavigableSet which is truly cloned UnmodifableNavigableSet, not just a wrapped Set.

 

 
{code:java}
Collections.unmodifiableList(ints).stream().map(a -> a + 1).map(a -> addSomething(1, ints)).collect(Collectors.toList());
 
private int addSomething(int current, List<Integer> ints) {
ints.add(1);
return current;
}
{code}
 

 

Here in above example when 2nd map phase modifies original set we get same ConcurrentModificationException.

> ERROR MetricsSourceAdapter: Error getting metrics from source SCMContainerMetrics java.util.ConcurrentModificationException
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDDS-6060
>                 URL: https://issues.apache.org/jira/browse/HDDS-6060
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: SCM
>            Reporter: George Huang
>            Assignee: George Huang
>            Priority: Major
>
> |1:23:33.841 PM|ERROR|MetricsSourceAdapter|Error getting metrics from source SCMContainerMetrics
> java.util.ConcurrentModificationException
> at java.util.TreeMap$KeySpliterator.forEachRemaining(TreeMap.java:2757)
> at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
> at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
> at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
> at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
> at org.apache.hadoop.hdds.scm.container.ContainerManagerImpl.getContainers(ContainerManagerImpl.java:172)
> at org.apache.hadoop.hdds.scm.server.StorageContainerManager.getContainerStateCount(StorageContainerManager.java:1769)
> at org.apache.hadoop.hdds.scm.server.SCMContainerMetrics.getMetrics(SCMContainerMetrics.java:68)
> at org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.getMetrics(MetricsSourceAdapter.java:200)
> at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.snapshotMetrics(MetricsSystemImpl.java:419)
> at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.sampleMetrics(MetricsSystemImpl.java:406)
> at org.apache.hadoop.metrics2.impl.MetricsSystemImpl.onTimerEvent(MetricsSystemImpl.java:381)
> at org.apache.hadoop.metrics2.impl.MetricsSystemImpl$4.run(MetricsSystemImpl.java:368)
> at java.util.TimerThread.mainLoop(Timer.java:555)
> at java.util.TimerThread.run(Timer.java:505)|



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org