You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2023/12/13 12:33:00 UTC
[jira] [Created] (HADOOP-19011) Possible ConcurrentModificationException if Exec command fails
Attila Doroszlai created HADOOP-19011:
-----------------------------------------
Summary: 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
{{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: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org