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);