Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-19011

Possible ConcurrentModificationException if Exec command fails

    XMLWordPrintableJSON

Details

    • Reviewed

    Description

      ConcurrentModificationException may happen in:

        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();
      

      due to accessing stdErr.getOutput() before stdErr thread stops.

      Attachments

        Issue Links

          Activity

            People

              adoroszlai Attila Doroszlai
              adoroszlai Attila Doroszlai
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: