Uploaded image for project: 'Hadoop Map/Reduce'
  1. Hadoop Map/Reduce
  2. MAPREDUCE-7139

TestShuffleProvider#testShuffleProviders and TestTaskAttemptContainerRequest#testAttemptContainerRequest fail since a static common container launch context does't recreate



    • Type: Bug
    • Status: Patch Available
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: test
    • Labels:


      TestShuffleProvider#testShuffleProviders fails with the following error:

      	at org.junit.Assert.fail(Assert.java:88)
      	at org.junit.Assert.assertTrue(Assert.java:41)
      	at org.junit.Assert.assertNotNull(Assert.java:621)
      	at org.apache.hadoop.mapreduce.v2.app.job.impl.TestShuffleProvider.testShuffleProviders(TestShuffleProvider.java:114)

      This error occurs only when we run TestShuffleProvider#testShuffleProviders test after some test which creates TaskAttemptImpl (For example after tests in TestMapReduceChildJVM).
      TestShuffleProvider#testShuffleProviders creates container launch context, set additionals NM aux services and expects to get these services from container launch context after creating.
      But we have the following code in TaskAttemptImpl:

      static ContainerLaunchContext createContainerLaunchContext(
            Map<ApplicationAccessType, String> applicationACLs,
            Configuration conf, Token<JobTokenIdentifier> jobToken, Task remoteTask,
            final org.apache.hadoop.mapred.JobID oldJobId,
            WrappedJvmID jvmID,
            TaskAttemptListener taskAttemptListener,
            Credentials credentials) {
          synchronized (commonContainerSpecLock) {
            if (commonContainerSpec == null) {
              commonContainerSpec = createCommonContainerLaunchContext(
                  applicationACLs, conf, jobToken, oldJobId, credentials);

      The property "commonContainerSpec" is static. As the result, we do not recreate common container launch within JVM. This is normal for AM JVM since all containers should be run with one context. But this leads to an error when we run unit tests in one JVM and expect to recreate container launch context.

      We can add a setter for "commonContainerSpec" with "VisibleForTesting" annotation and reset CLC in a test if we need it.
      Also, we can cleanup CLC after running tests in @After fixture which create CLC but we have too many tests which use TaskAttemptImpl and do not need cleanup.

      The same issue occurre in TestTaskAttemptContainerRequest#testAttemptContainerRequest. Since we create CLC by TaskAttemptImpl.createContainerLaunchContext.


        1. screenshot-2.png
          63 kB
          Oleksandr Shevchenko
        2. screenshot-1.png
          84 kB
          Oleksandr Shevchenko
        3. MAPREDUCE-7139.002.patch
          3 kB
          Oleksandr Shevchenko
        4. MAPREDUCE-7139.001.patch
          2 kB
          Oleksandr Shevchenko



            • Assignee:
              oshevchenko Oleksandr Shevchenko
              oshevchenko Oleksandr Shevchenko
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: