[
https://issues.apache.org/jira/browse/YARN-7595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16284381#comment-16284381
]
Jason Lowe commented on YARN-7595:
----------------------------------
Thanks for the patch! Looks good overall, just a few nits.
{{containerScriptOutStream}} is created significantly before it really needs to
be. There's a lot of stuff in the try block that does not need to be there,
and we could postpone creating the script stream until just before the
writeLaunchEnv call.
Nit: We could save some indentation on the following by putting the two
resources in the same try-with-resources block rather than nesting one block
within another. Not a must-fix, it's OK as nested blocks. If we keep it
nested the line break on the PrintStream creation is unnecessary.
{code}
try (DataOutputStream out =
lfs.create(wrapperScriptPath, EnumSet.of(CREATE, OVERWRITE))) {
try (PrintStream pout =
new PrintStream(out, false,"UTF-8")) {
writeLocalWrapperScript(launchDst, pidFile, pout);
}
}
{code}
I filed YARN-7629 to track the unrelated TestContainerLaunch failure.
> Container launching code suppresses close exceptions after writes
> -----------------------------------------------------------------
>
> Key: YARN-7595
> URL: https://issues.apache.org/jira/browse/YARN-7595
> Project: Hadoop YARN
> Issue Type: Bug
> Components: nodemanager
> Reporter: Jason Lowe
> Assignee: Jim Brennan
> Attachments: YARN-7595.001.patch
>
>
> There are a number of places in code related to container launching where the
> following pattern is used:
> {code}
> try {
> ...write to stream outStream...
> } finally {
> IOUtils.cleanupWithLogger(LOG, outStream);
> }
> {code}
> Unfortunately this suppresses any IOException that occurs during the close()
> method on outStream. If the stream is buffered or could otherwise fail to
> finish writing the file when trying to close then this can lead to
> partial/corrupted data without throwing an I/O error.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]