Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-23904

StreamGobbler fails in 10% of cases

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.4.0.Final
    • 4.4.3.AM2
    • cdk
    • None

      The StreamGobbler implementation in CDKLaunchUtility fails in about 10% of cases. An example standalone java class with copied code demonstrates this:

      https://paste.fedoraproject.org/paste/F1QIqHhefBIXCECQPW9RuV5M1UNdIGYhyRLivL9gydE=

      After playing with it (trying to run a command with a space in the path), I discovered it failed in two different ways about 10% of the time. This is due to lack of synchronization. The thread reading the stream might be asked for its results AFTER the process has ended, but BEFORE the stream has been read completely.

      Two things were needed: 1) synchronized control for extremely short calls to add a line that's been read or check if the flow has been canceled, and 2) a delay in getting hte final output even after the process has ended, as there may still be lines to read in the stream.

            rob.stryker Rob Stryker (Inactive)
            rob.stryker Rob Stryker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: