Derby
  1. Derby
  2. DERBY-5608

BaseTestCase.readProcessOutput should read getInputStream() and getErrorStream() in separate threads

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.9.1.0
    • Fix Version/s: 10.8.3.0, 10.9.1.0
    • Component/s: Test
    • Labels:
      None

      Description

      BaseTestCase.readProcessOutput() reads the streams from Process.getInputStream() and Process.getErrorStream() sequentially
      InputStream is = pr.getInputStream();
      InputStream es = pr.getErrorStream();
      ...
      output += "<STDOUT> " + inputStreamToString(is) + "<END STDOUT>\n";
      output += "<STDERR>" + inputStreamToString(es) + "<END STDERR>\n";

      I think that to be really correct the two streams need to be read in separate threads because if the error output is large it could block and cause a hang if they are read sequentially like this.

      I noticed during the DERBY-5601 discussion as Myrna referenced in that the addition of draining the error stream caused a different problem (an InterruptException). I don't understand how it could cause that problem but do think a hang blocking on reading the input would be possible if the error output was large enough both before and after the change to add the reading of the error stream sequentially.

        Issue Links

          Activity

          Kathey Marsden created issue -
          Kristian Waagan made changes -
          Field Original Value New Value
          Attachment derby-5608-1a-use_spawnedprocess.diff [ 12513969 ]
          Kristian Waagan made changes -
          Assignee Kristian Waagan [ kristwaa ]
          Issue & fix info Patch Available [ 10102 ]
          Kristian Waagan made changes -
          Kristian Waagan made changes -
          Fix Version/s 10.9.0.0 [ 12316344 ]
          Issue & fix info Patch Available [ 10102 ]
          Myrna van Lunteren made changes -
          Link This issue relates to DERBY-5601 [ DERBY-5601 ]
          Kristian Waagan made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 10.8.2.3 [ 12318540 ]
          Resolution Fixed [ 1 ]
          Kathey Marsden made changes -
          Fix Version/s 10.8.3.0 [ 12323456 ]
          Fix Version/s 10.8.2.3 [ 12318540 ]
          Gavin made changes -
          Workflow jira [ 12652590 ] Default workflow, editable Closed status [ 12802131 ]
          Knut Anders Hatlen made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Kristian Waagan
              Reporter:
              Kathey Marsden
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development