Skip to content

Commit 1739e75

Browse files
author
Marcelo Vanzin
committed
[SPARK-16586][CORE] Handle JVM errors printed to stdout.
Some very rare JVM errors are printed to stdout, and that confuses the code in spark-class. So add a check so that those cases are detected and the proper error message is shown to the user. Tested by running spark-submit after setting "ulimit -v 32000". Closes apache#14231 Author: Marcelo Vanzin <[email protected]> Closes apache#14508 from vanzin/SPARK-16586.
1 parent 5959df2 commit 1739e75

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bin/spark-class

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ done < <(build_command "$@")
8080
COUNT=${#CMD[@]}
8181
LAST=$((COUNT - 1))
8282
LAUNCHER_EXIT_CODE=${CMD[$LAST]}
83+
84+
# Certain JVM failures result in errors being printed to stdout (instead of stderr), which causes
85+
# the code that parses the output of the launcher to get confused. In those cases, check if the
86+
# exit code is an integer, and if it's not, handle it as a special error case.
87+
if ! [[ $LAUNCHER_EXIT_CODE =~ ^[0-9]+$ ]]; then
88+
echo "${CMD[@]}" | head -n-1 1>&2
89+
exit 1
90+
fi
91+
8392
if [ $LAUNCHER_EXIT_CODE != 0 ]; then
8493
exit $LAUNCHER_EXIT_CODE
8594
fi

0 commit comments

Comments
 (0)