Hadoop Common
  1. Hadoop Common
  2. HADOOP-1271

The StreamBaseRecordReader is unable to log record data that's not UTF-8

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.13.0
    • Component/s: None
    • Labels:
      None

      Description

      Streaming code at times can work on data that's not UTF-8, for instance image/audio data. The StreamBaseRecordReader tries to log some status info, which contains part of the record, using the LOG.info() call. This call throws this exception :

      java.lang.ArrayIndexOutOfBoundsException
      at java.lang.System.arraycopy(Native Method)
      at java.io.BufferedOutputStream.write(BufferedOutputStream.java:111)
      at org.apache.hadoop.mapred.TaskLog$Writer.write(TaskLog.java:217)
      at org.apache.hadoop.mapred.TaskLogAppender.append(TaskLogAppender.java:51)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:230)
      at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:65)
      at org.apache.log4j.Category.callAppenders(Category.java:203)
      at org.apache.log4j.Category.forcedLog(Category.java:388)
      at org.apache.log4j.Category.log(Category.java:853)
      at org.apache.commons.logging.impl.Log4JLogger.info(Log4JLogger.java:133)
      at org.apache.hadoop.streaming.StreamBaseRecordReader.numRecStats(StreamBaseRecordReader.java:114)
      at org.apache.hadoop.streaming.StreamXmlRecordReader.next(StreamXmlRecordReader.java:99)
      at org.apache.hadoop.mapred.MapTask$1.next(MapTask.java:157)
      at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:46)
      at org.apache.hadoop.mapred.MapTask.run(MapTask.java:175)
      at org.apache.hadoop.mapred.TaskTracker$Child.main(TaskTracker.java:1445)

        Activity

        Hide
        Arun C Murthy added a comment -

        Here is a simple fix for TaskLogAppender.append - there was a wrong assumption of no. of UTF-8 chars is equal to no. of raw bytes, which obviously isn't true.

        Show
        Arun C Murthy added a comment - Here is a simple fix for TaskLogAppender.append - there was a wrong assumption of no. of UTF-8 chars is equal to no. of raw bytes , which obviously isn't true.
        Hide
        Arun C Murthy added a comment -

        Gautam, could you please check if this works? Thanks!

        Show
        Arun C Murthy added a comment - Gautam, could you please check if this works? Thanks!
        Show
        Hadoop QA added a comment - +1 http://issues.apache.org/jira/secure/attachment/12355917/HADOOP-1271_20070420_1.patch applied and successfully tested against trunk revision r530556. Test results: http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/68/testReport/ Console output: http://lucene.zones.apache.org:8080/hudson/job/Hadoop-Patch/68/console
        Hide
        Owen O'Malley added a comment -

        +1

        This is a necessary fix.

        Show
        Owen O'Malley added a comment - +1 This is a necessary fix.
        Hide
        Tom White added a comment -

        I've just committed this. Thanks Arun!

        Show
        Tom White added a comment - I've just committed this. Thanks Arun!

          People

          • Assignee:
            Arun C Murthy
            Reporter:
            Gautam Kowshik
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development