Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-8686

IO stream copies are not done properly

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Blocker
    • Resolution: Fixed
    • core
    • None

    Description

      Investigating JENKINS-5073 I've noticed that in some places, IO Stream copy isn't done properly as we don't check for -1 but for > 0 when reading from the input streams.
      At least in two places.

      Could have major impacts on the stability of the system.

      Attachments

        Activity

          lacostej lacostej added a comment -

          Some work done on
          https://github.com/lacostej/jenkins/commits/lacostej-pull-proper-io-copy

          Would appreciate some feedback on the issues/remaining tasks listed in the TODO (root FS)

          Currently https://github.com/lacostej/jenkins/blob/cd748d457344549a7508cb0d60cd7392e25a0642/TODO

          lacostej lacostej added a comment - Some work done on https://github.com/lacostej/jenkins/commits/lacostej-pull-proper-io-copy Would appreciate some feedback on the issues/remaining tasks listed in the TODO (root FS) Currently https://github.com/lacostej/jenkins/blob/cd748d457344549a7508cb0d60cd7392e25a0642/TODO

          Note that InputStream.read(byte[]) can only legally return 0 if the given byte array is of length 0. So I doubt if this is causing the stability problem.

          With that said, being defensive is a good thing, so we should merge the changes. It appears that your branch is complete — shall we merge it to the trunk?

          kohsuke Kohsuke Kawaguchi added a comment - Note that InputStream.read(byte[]) can only legally return 0 if the given byte array is of length 0. So I doubt if this is causing the stability problem. With that said, being defensive is a good thing, so we should merge the changes. It appears that your branch is complete — shall we merge it to the trunk?
          lacostej lacostej added a comment -

          I've seen InputStream implementations that returned 0 even if there was available data.
          That was with Oracle JDBC drivers. So it probably doesn't affect jenkins.

          lacostej lacostej added a comment - I've seen InputStream implementations that returned 0 even if there was available data. That was with Oracle JDBC drivers. So it probably doesn't affect jenkins.
          evernat evernat added a comment -

          Hi lacostej,
          Is it ok now?

          evernat evernat added a comment - Hi lacostej, Is it ok now?
          dogfood dogfood added a comment -

          Integrated in jenkins_main_trunk #2429
          [FIXED JENKINS-8686] (Revision dc94b7d0633c0a6e5375bdf1bec2b9dede461da3)

          Result = SUCCESS
          kohsuke : dc94b7d0633c0a6e5375bdf1bec2b9dede461da3
          Files :

          • core/src/main/java/hudson/util/StreamCopyThread.java
          • core/src/main/java/hudson/Proc.java
          • core/src/main/java/hudson/util/io/ZipArchiver.java
          • cli/src/main/java/hudson/cli/CLI.java
          • core/src/main/java/hudson/Util.java
          dogfood dogfood added a comment - Integrated in jenkins_main_trunk #2429 [FIXED JENKINS-8686] (Revision dc94b7d0633c0a6e5375bdf1bec2b9dede461da3) Result = SUCCESS kohsuke : dc94b7d0633c0a6e5375bdf1bec2b9dede461da3 Files : core/src/main/java/hudson/util/StreamCopyThread.java core/src/main/java/hudson/Proc.java core/src/main/java/hudson/util/io/ZipArchiver.java cli/src/main/java/hudson/cli/CLI.java core/src/main/java/hudson/Util.java

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          cli/src/main/java/hudson/cli/CLI.java
          core/src/main/java/hudson/Proc.java
          core/src/main/java/hudson/Util.java
          core/src/main/java/hudson/util/StreamCopyThread.java
          core/src/main/java/hudson/util/io/ZipArchiver.java
          http://jenkins-ci.org/commit/jenkins/dc94b7d0633c0a6e5375bdf1bec2b9dede461da3
          Log:
          [FIXED JENKINS-8686]

          As I mentioned in the comment, I doubt if this makes any behaviour change, but this seems like a sensible defensive measure that wouldn't hurt.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: cli/src/main/java/hudson/cli/CLI.java core/src/main/java/hudson/Proc.java core/src/main/java/hudson/Util.java core/src/main/java/hudson/util/StreamCopyThread.java core/src/main/java/hudson/util/io/ZipArchiver.java http://jenkins-ci.org/commit/jenkins/dc94b7d0633c0a6e5375bdf1bec2b9dede461da3 Log: [FIXED JENKINS-8686] As I mentioned in the comment, I doubt if this makes any behaviour change, but this seems like a sensible defensive measure that wouldn't hurt.

          People

            lacostej lacostej
            lacostej lacostej
            Votes:
            7 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: