Hadoop Map/Reduce
  1. Hadoop Map/Reduce
  2. MAPREDUCE-796

Encountered "ClassCastException" on tasktracker while running wordcount with MultithreadedMapRunner

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.20.1
    • Fix Version/s: 0.20.1
    • Component/s: examples
    • Labels:
      None
    • Hadoop Flags:
      Reviewed
    • Release Note:
      Multithreaded mapper was modified to create a new Runtime exception (object) from a throwable instead of casting a throwable into a RuntimeException, once the Multithreaded map encounters a fault.
    • Tags:
      ygridqa

      Description

      ClassCastException for OutOfMemoryError is encountered on tasktracker while running wordcount example with MultithreadedMapRunner.

      Stack trace :
      =========
      java.lang.ClassCastException: java.lang.OutOfMemoryError cannot be cast to java.lang.RuntimeException
      at org.apache.hadoop.mapreduce.lib.map.MultithreadedMapper.run(MultithreadedMapper.java:149)
      at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:581)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:303)
      at org.apache.hadoop.mapred.Child.main(Child.java:170)

        Activity

        Hide
        Arun C Murthy added a comment -

        I see the problem in org.apache.hadoop.mapreduce.lib.map.MultithreadedMapper.run with the following fix:

        diff --git src/mapred/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java src/mapred/org/apach
        index 2e0d6d9..95530f9 100644
        --- src/mapred/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java
        +++ src/mapred/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java
        @@ -146,7 +146,7 @@ public class MultithreadedMapper<K1, V1, K2, V2>
                 } else if (th instanceof InterruptedException) {
                   throw (InterruptedException) th;
                 } else {
        -          throw (RuntimeException) th;
        +          throw new RuntimeException(th);
                 }
               }
             }
        

        The else block should probably be:

        Show
        Arun C Murthy added a comment - I see the problem in org.apache.hadoop.mapreduce.lib.map.MultithreadedMapper.run with the following fix: diff --git src/mapred/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java src/mapred/org/apach index 2e0d6d9..95530f9 100644 --- src/mapred/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java +++ src/mapred/org/apache/hadoop/mapreduce/lib/map/MultithreadedMapper.java @@ -146,7 +146,7 @@ public class MultithreadedMapper<K1, V1, K2, V2> } else if (th instanceof InterruptedException) { throw (InterruptedException) th; } else { - throw (RuntimeException) th; + throw new RuntimeException(th); } } } The else block should probably be:
        Hide
        Suman Sehgal added a comment -

        Observations taken with different set of config parameters for the above mentioned scenario are as follows:

        Observation 1:
        =============
        Heap Size - (mapred.child.java.opts) --> 640MB
        Compression code - LzoCodec
        Native lib enabled
        Result --> ClassCastException with OutOfMemoryError

        Observation 2:
        =============
        Heap Size - (mapred.child.java.opts) --> 768MB
        Compression code - LzoCodec
        Native lib enabled
        Result --> No Exception/Error

        Observation 3:
        =============
        Heap Size - (mapred.child.java.opts) --> 640MB
        Compression code - DefaultCodec
        Native lib disabled
        Result --> No Exception/Error

        Show
        Suman Sehgal added a comment - Observations taken with different set of config parameters for the above mentioned scenario are as follows: Observation 1: ============= Heap Size - (mapred.child.java.opts) --> 640MB Compression code - LzoCodec Native lib enabled Result --> ClassCastException with OutOfMemoryError Observation 2: ============= Heap Size - (mapred.child.java.opts) --> 768MB Compression code - LzoCodec Native lib enabled Result --> No Exception/Error Observation 3: ============= Heap Size - (mapred.child.java.opts) --> 640MB Compression code - DefaultCodec Native lib disabled Result --> No Exception/Error
        Hide
        Devaraj Das added a comment -

        Looks like this is a problem caused by a combination of MultiThreadedMapRunner and enabling Native Compression.

        Show
        Devaraj Das added a comment - Looks like this is a problem caused by a combination of MultiThreadedMapRunner and enabling Native Compression.
        Hide
        Devaraj Das added a comment -

        Sorry, forgot to add that an increased heap size is a solution to the problem.

        Show
        Devaraj Das added a comment - Sorry, forgot to add that an increased heap size is a solution to the problem.
        Hide
        Amar Kamat added a comment -

        Attaching a simple fix.

        Show
        Amar Kamat added a comment - Attaching a simple fix.
        Hide
        Amareshwari Sriramadasu added a comment -

        +1

        Show
        Amareshwari Sriramadasu added a comment - +1
        Hide
        Devaraj Das added a comment -

        I just committed this. Thanks, Amar!

        Show
        Devaraj Das added a comment - I just committed this. Thanks, Amar!
        Hide
        Hudson added a comment -

        Integrated in Hadoop-Mapreduce-trunk #41 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Mapreduce-trunk/41/)
        . Fixes a ClassCastException in an exception log in MultiThreadedMapRunner. Contributed by Amar Kamat.

        Show
        Hudson added a comment - Integrated in Hadoop-Mapreduce-trunk #41 (See http://hudson.zones.apache.org/hudson/job/Hadoop-Mapreduce-trunk/41/ ) . Fixes a ClassCastException in an exception log in MultiThreadedMapRunner. Contributed by Amar Kamat.

          People

          • Assignee:
            Amar Kamat
            Reporter:
            Suman Sehgal
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development