[
https://issues.apache.org/jira/browse/YARN-5219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sunil G updated YARN-5219:
--------------------------
Attachment: YARN-5219.003.patch
Had offline discussion with [~vvasudev] and thought of doing below way.
Any shell variable substitution with *empty* value can be considered as error
and *launch_container.sh* can be failed. This can help to avoid any type of
unwanted and invalid variables which are exposed as env variables. Its better
to do this in trunk.
For branch-2, we can report such errors and log it for now. So script will have
some validators and will write errors to console. It can atleast help to debug
whether all env variables are cleanly exported or not.
Attaching script based on trunk solution. I am also attaching a trunk patch for
now. Will add branch-2 patch in a short while. pls share your thoughts.
{noformat}
#!/bin/bash
err_report() {
echo "Error on line ${1} while substituting for ${2}"
}
verify_shell_variable() {
echo "Shell variable ${1} is defined as ${2:? `err_report ${LINENO} ${1}`}"
}
export foo="2.4.6"
export testVar="version${foo}"
toValidate=${foo}
verify_shell_variable testVar ${toValidate}
exec /bin/bash -c ""
hadoop_shell_errorcode=$?
if [ $hadoop_shell_errorcode -ne 0 ]
then
exit $hadoop_shell_errorcode
fi
{noformat}
> When an export var command fails in launch_container.sh, the full container
> launch should fail
> ----------------------------------------------------------------------------------------------
>
> Key: YARN-5219
> URL: https://issues.apache.org/jira/browse/YARN-5219
> Project: Hadoop YARN
> Issue Type: Bug
> Reporter: Hitesh Shah
> Assignee: Sunil G
> Attachments: YARN-5219.001.patch, YARN-5219.003.patch
>
>
> Today, a container fails if certain files fail to localize. However, if
> certain env vars fail to get setup properly either due to bugs in the yarn
> application or misconfiguration, the actual process launch still gets
> triggered. This results in either confusing error messages if the process
> fails to launch or worse yet the process launches but then starts behaving
> wrongly if the env var is used to control some behavioral aspects.
> In this scenario, the issue was reproduced by trying to do export
> abc="$\{foo.bar}" which is invalid as var names cannot contain "." in bash.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]