[
https://issues.apache.org/jira/browse/HADOOP-19011?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17796875#comment-17796875
]
ASF GitHub Bot commented on HADOOP-19011:
-----------------------------------------
adoroszlai merged PR #6353:
URL: https://github.com/apache/hadoop/pull/6353
> Possible ConcurrentModificationException if Exec command fails
> --------------------------------------------------------------
>
> Key: HADOOP-19011
> URL: https://issues.apache.org/jira/browse/HADOOP-19011
> Project: Hadoop Common
> Issue Type: Bug
> Reporter: Attila Doroszlai
> Assignee: Attila Doroszlai
> Priority: Major
> Labels: pull-request-available
>
> {{ConcurrentModificationException}} may happen in:
> {code:title=https://github.com/apache/hadoop/blob/19b9e6a97b8faa0eb48e7b1855ab37e6d4b6c2a9/hadoop-maven-plugins/src/main/java/org/apache/hadoop/maven/plugin/util/Exec.java#L64-L82}
> public int run(List<String> command, List<String> output,
> List<String> errors) {
> int retCode = 1;
> ProcessBuilder pb = new ProcessBuilder(command);
> try {
> Process p = pb.start();
> OutputBufferThread stdOut = new OutputBufferThread(p.getInputStream());
> OutputBufferThread stdErr = new OutputBufferThread(p.getErrorStream());
> stdOut.start();
> stdErr.start();
> retCode = p.waitFor();
> if (retCode != 0) {
> mojo.getLog().warn(command + " failed with error code " + retCode);
> for (String s : stdErr.getOutput()) {
> mojo.getLog().debug(s);
> }
> }
> stdOut.join();
> stdErr.join();
> {code}
> due to accessing {{stdErr.getOutput()}} before {{stdErr}} thread stops.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]