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

FindBugs: Channel#current() may return null, not all routines in the core handle that

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core, remoting
    • None

      Remoting versions since 3.11 have explicit annotations for Channel#getCurrent(), and there are lots of FindBugs issues reported due to that. All usages are safe, so there is no need in backporting.

      My proposal is to...

      1) Add a convenience default method to Remoting's Callable, which throws IOException
      2) Use the new convenience method in all Callable implementations in the core

          [JENKINS-48055] FindBugs: Channel#current() may return null, not all routines in the core handle that

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/hudson/remoting/Callable.java
          src/main/java/hudson/remoting/RemoteInvocationHandler.java
          src/main/java/hudson/remoting/forward/PortForwarder.java
          src/main/java/org/jenkinsci/remoting/ChannelStateException.java
          src/test/java/hudson/remoting/ChannelTest.java
          src/test/java/hudson/remoting/ClassRemotingTest.java
          src/test/java/org/jenkinsci/remoting/protocol/ProtocolStackImplTest.java
          http://jenkins-ci.org/commit/remoting/df3dc722364651238c948c1a6b45660467580ce4
          Log:
          JENKINS-48055 - Introduce convenient Channel retrieval methods in Callables.

          This change introduces new API, which is expected to cleanup FindBugs reports in the core and to offer better diagnostics of edge cases.
          The logic also allows failing fast when the channel is being terminated.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/remoting/Callable.java src/main/java/hudson/remoting/RemoteInvocationHandler.java src/main/java/hudson/remoting/forward/PortForwarder.java src/main/java/org/jenkinsci/remoting/ChannelStateException.java src/test/java/hudson/remoting/ChannelTest.java src/test/java/hudson/remoting/ClassRemotingTest.java src/test/java/org/jenkinsci/remoting/protocol/ProtocolStackImplTest.java http://jenkins-ci.org/commit/remoting/df3dc722364651238c948c1a6b45660467580ce4 Log: JENKINS-48055 - Introduce convenient Channel retrieval methods in Callables. This change introduces new API, which is expected to cleanup FindBugs reports in the core and to offer better diagnostics of edge cases. The logic also allows failing fast when the channel is being terminated.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/hudson/remoting/Callable.java
          src/main/java/hudson/remoting/ChannelClosedException.java
          src/main/java/org/jenkinsci/remoting/ChannelStateException.java
          http://jenkins-ci.org/commit/remoting/15154980e3660ed2410b91fdbf7d49f7fb9ec105
          Log:
          JENKINS-48055 - Integrate ChannelClosedException and ChannelStateException.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/remoting/Callable.java src/main/java/hudson/remoting/ChannelClosedException.java src/main/java/org/jenkinsci/remoting/ChannelStateException.java http://jenkins-ci.org/commit/remoting/15154980e3660ed2410b91fdbf7d49f7fb9ec105 Log: JENKINS-48055 - Integrate ChannelClosedException and ChannelStateException.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          src/main/java/hudson/remoting/Callable.java
          src/main/java/hudson/remoting/ChannelClosedException.java
          src/main/java/hudson/remoting/RemoteInvocationHandler.java
          src/main/java/hudson/remoting/forward/PortForwarder.java
          src/main/java/org/jenkinsci/remoting/ChannelStateException.java
          src/test/java/hudson/remoting/ChannelTest.java
          src/test/java/hudson/remoting/ClassRemotingTest.java
          src/test/java/org/jenkinsci/remoting/protocol/ProtocolStackImplTest.java
          http://jenkins-ci.org/commit/remoting/9b8fd56e780f0c042c8ac35333e87faba8c5f81f
          Log:
          Merge pull request #228 from oleg-nenashev/feature/JENKINS-48055

          JENKINS-48055 - Introduce convenient Channel retrieval methods in Callables.

          Compare: https://github.com/jenkinsci/remoting/compare/33692ca9dab4...9b8fd56e780f

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: src/main/java/hudson/remoting/Callable.java src/main/java/hudson/remoting/ChannelClosedException.java src/main/java/hudson/remoting/RemoteInvocationHandler.java src/main/java/hudson/remoting/forward/PortForwarder.java src/main/java/org/jenkinsci/remoting/ChannelStateException.java src/test/java/hudson/remoting/ChannelTest.java src/test/java/hudson/remoting/ClassRemotingTest.java src/test/java/org/jenkinsci/remoting/protocol/ProtocolStackImplTest.java http://jenkins-ci.org/commit/remoting/9b8fd56e780f0c042c8ac35333e87faba8c5f81f Log: Merge pull request #228 from oleg-nenashev/feature/ JENKINS-48055 JENKINS-48055 - Introduce convenient Channel retrieval methods in Callables. Compare: https://github.com/jenkinsci/remoting/compare/33692ca9dab4...9b8fd56e780f

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/Launcher.java
          core/src/main/java/hudson/model/Computer.java
          core/src/main/java/hudson/slaves/ChannelPinger.java
          core/src/main/java/hudson/slaves/SlaveComputer.java
          core/src/main/java/jenkins/FilePathFilter.java
          core/src/main/java/jenkins/slaves/StandardOutputSwapper.java
          pom.xml
          test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java
          test/src/test/java/jenkins/security/Security218CliTest.java
          http://jenkins-ci.org/commit/jenkins/cb3990a4d6094260bea4571e7079fd0e3949047f
          Log:
          Update to Remoting 3.15 and Cleanup issues in Channel#current() usages (#3145)

          Pulls in fixes for: JENKINS-48133, JENKINS-48055, JENKINS-37566, JENKINS-48309, JENKINS-47965, JENKINS-48130, JENKINS-37670, JENKINS-37566, JENKINS-46724

          This change also adds some missing null/closing channel checks in the core.
          In some cases the change prevents spawning threads if the channel is in the invalid state.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/Launcher.java core/src/main/java/hudson/model/Computer.java core/src/main/java/hudson/slaves/ChannelPinger.java core/src/main/java/hudson/slaves/SlaveComputer.java core/src/main/java/jenkins/FilePathFilter.java core/src/main/java/jenkins/slaves/StandardOutputSwapper.java pom.xml test/src/test/java/hudson/bugs/JnlpAccessWithSecuredHudsonTest.java test/src/test/java/jenkins/security/Security218CliTest.java http://jenkins-ci.org/commit/jenkins/cb3990a4d6094260bea4571e7079fd0e3949047f Log: Update to Remoting 3.15 and Cleanup issues in Channel#current() usages (#3145) Pulls in fixes for: JENKINS-48133 , JENKINS-48055 , JENKINS-37566 , JENKINS-48309 , JENKINS-47965 , JENKINS-48130 , JENKINS-37670 , JENKINS-37566 , JENKINS-46724 This change also adds some missing null/closing channel checks in the core. In some cases the change prevents spawning threads if the channel is in the invalid state.

          Oleg Nenashev added a comment -

          The change has been released in Remoting 3.15 and integrated towards Jenkins 2.98

          Oleg Nenashev added a comment - The change has been released in Remoting 3.15 and integrated towards Jenkins 2.98

            oleg_nenashev Oleg Nenashev
            oleg_nenashev Oleg Nenashev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: