Karl D. Gierach created MAPREDUCE-5253:
------------------------------------------
Summary: Whitespace value entry in mapred-site.xml for
name=mapred.reduce.child.java.opts causes child tasks to fail at launch
Key: MAPREDUCE-5253
URL: https://issues.apache.org/jira/browse/MAPREDUCE-5253
Project: Hadoop Map/Reduce
Issue Type: Bug
Components: task
Affects Versions: 1.1.2
Environment: Centos 6.2 32Bit, OpenJDK
Reporter: Karl D. Gierach
Fix For: 1.1.3
Hi,
Below is a patch for Hadoop v1.1.2. I'm new to this list, so if I need to
write up a JIRA ticket for this, please let me know.
The defect scenario is that if you enter any white space within values in this
file:
/etc/hadoop/mapred-site.xml
e.g.: (a white space prior to the -X...)
<property>
<name>mapred.reduce.child.java.opts</name>
<value> -Xmx1G</value>
</property>
All of the child jobs fail, and each child gets an error in the stderr log like:
Could not find the main class: . Program will exit.
The root cause is obvious in the patch below - the split on the value was done
on whitespace, and any preceding whitespace ultimately becomes a zero-length
entry on the child jvm command line, causing the jvm to think that a ''
argument is the main class. The patch just skips over any zero-length entries
prior to adding them to the jvm vargs list. I looked in trunk as well, to see
if the patch would apply there but it looks like Tasks were refactored and this
code file is not present any more.
This error occurred on Open JDK, Centos 6.2, 32 bit.
Regards,
Karl
Index: src/mapred/org/apache/hadoop/mapred/TaskRunner.java
===================================================================
--- src/mapred/org/apache/hadoop/mapred/TaskRunner.java (revision 1482686)
+++ src/mapred/org/apache/hadoop/mapred/TaskRunner.java (working copy)
@@ -437,7 +437,9 @@
vargs.add("-Djava.library.path=" + libraryPath);
}
for (int i = 0; i < javaOptsSplit.length; i++) {
- vargs.add(javaOptsSplit[i]);
+ if( javaOptsSplit[i].trim().length() > 0 ) {
+ vargs.add(javaOptsSplit[i]);
+ }
}
Path childTmpDir = createChildTmpDir(workDir, conf, false);
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira