Peter Bacsko created YARN-10447: ----------------------------------- Summary: TestLeafQueue: ActivitiesManager thread might interfere with ongoing stubbing Key: YARN-10447 URL: https://issues.apache.org/jira/browse/YARN-10447 Project: Hadoop YARN Issue Type: Bug Components: test Reporter: Peter Bacsko Assignee: Peter Bacsko
YARN-9784 fixed some concurrency related issues in {{TestLeafQueue}}, but not all of them. Occasionally it's still possible to receive an exception from Mockito and the two following stack traces can be observed in the console: {noformat} org.mockito.exceptions.misusing.WrongTypeOfReturnValue: Integer cannot be returned by isMultiNodePlacementEnabled() isMultiNodePlacementEnabled() should return boolean *** If you're unsure why you're getting above error read on. Due to the nature of the syntax above problem might occur because: 1. This exception *might* occur in wrongly written multi-threaded tests. Please refer to Mockito FAQ on limitations of concurrency testing. 2. A spy is stubbed using when(spy.foo()).then() syntax. It is safer to stub spies - - with doReturn|Throw() family of methods. More in javadocs for Mockito.spy() method. {noformat} and {noformat} 2020-09-22 14:44:52,584 INFO [main] capacity.TestUtils (TestUtils.java:getMockNode(227)) - node = 127.0.0.3 avail=<memory:8192, vCores:1> 2020-09-22 14:44:52,585 INFO [main] capacity.TestUtils (TestUtils.java:getMockNode(227)) - node = 127.0.0.4 avail=<memory:8192, vCores:1> Exception in thread "ActivitiesManager thread." java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean at org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler$$EnhancerByMockitoWithCGLIB$$272c72c5.isMultiNodePlacementEnabled(<generated>) at org.apache.hadoop.yarn.server.resourcemanager.scheduler.activities.ActivitiesManager.dynamicallyUpdateAppActivitiesMaxQueueLengthIfNeeded(ActivitiesManager.java:266) at org.apache.hadoop.yarn.server.resourcemanager.scheduler.activities.ActivitiesManager.access$500(ActivitiesManager.java:63) at org.apache.hadoop.yarn.server.resourcemanager.scheduler.activities.ActivitiesManager$1.run(ActivitiesManager.java:347) at java.lang.Thread.run(Thread.java:748) {noformat} It's probably best to disable ActivitiesManager thread entirely in this test class, there is no need for it. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: yarn-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: yarn-dev-h...@hadoop.apache.org