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

Masking classLoader doesn`t work on remote Slave

      After upgrading the Apache httpClient to 4.4, I found that other plugins such as Git-Client/Maven-plugin that also uses httpClient with different versions collapses with ours. So After I added the Mask-Classes attribute the problem was gone, but it looks like this isolated environment dose not apply for Slaves.

      I found out that in the RemoteClassLoader while it tries to find a specific class URL, Which.classFileUrl(class) uses the getResource method. This method is not override by the hudson.util.MaskingClassLoader. So the class comes from the right source under the plugin itself, but the resource URL of the same class can came from other source such as other plugins that contain the same classes.

      Error example that I get:

      at hudson.model.Executor.run(Executor.java:240)
      Caused by: java.io.IOException: Remote call on local-windows failed
      at hudson.remoting.Channel.call(Channel.java:748)
      at hudson.FilePath.act(FilePath.java:907)
      ... 9 more
      Caused by: java.lang.NoSuchFieldError: INSTANCE
      at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:52)
      at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<init>(DefaultHttpRequestWriterFactory.java:56)
      at org.apache.http.impl.io.DefaultHttpRequestWriterFactory.<clinit>(DefaultHttpRequestWriterFactory.java:46)
      at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConnectionFactory.java:72)
      at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<init>(ManagedHttpClientConnectionFactory.java:84)
      at org.apache.http.impl.conn.ManagedHttpClientConnectionFactory.<clinit>(ManagedHttpClientConnectionFactory.java:59)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$InternalConnectionFactory.<init>(PoolingHttpClientConnectionManager.java:493)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:149)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:138)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.<init>(PoolingHttpClientConnectionManager.java:114)
      at org.apache.http.impl.client.HttpClientBuilder.build(HttpClientBuilder.java:726)
      at org.jfrog.build.client.HttpClientConfigurator.getClient(HttpClientConfigurator.java:91)
      at org.jfrog.build.client.ArtifactoryHttpClient.getHttpClient(ArtifactoryHttpClient.java:140)
      at org.jfrog.build.client.ArtifactoryHttpClient.execute(ArtifactoryHttpClient.java:209)
      at org.jfrog.build.client.ArtifactoryHttpClient.upload(ArtifactoryHttpClient.java:205)
      at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.uploadFile(ArtifactoryBuildInfoClient.java:603)
      at org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient.deployArtifact(ArtifactoryBuildInfoClient.java:315)
      at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.deploy(GenericArtifactsDeployer.java:179)
      at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.invoke(GenericArtifactsDeployer.java:151)
      at org.jfrog.hudson.generic.GenericArtifactsDeployer$FilesDeployerCallable.invoke(GenericArtifactsDeployer.java:119)
      at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2484)
      at hudson.remoting.UserRequest.perform(UserRequest.java:118)
      at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      at hudson.remoting.Request$2.run(Request.java:328)
      at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
      at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at hudson.remoting.Engine$1$1.run(Engine.java:63)
      at java.lang.Thread.run(Thread.java:744)

          [JENKINS-27289] Masking classLoader doesn`t work on remote Slave

          lior hasson added a comment -

          This issue is a real blocker for us, Our next plugin (Artifactory) release version was planned to support SNI connection with the help of Apache httpClient 4.3.5 or 4.4.

          Link to Pull Request: https://github.com/jenkinsci/jenkins/pull/1598

          lior hasson added a comment - This issue is a real blocker for us, Our next plugin (Artifactory) release version was planned to support SNI connection with the help of Apache httpClient 4.3.5 or 4.4. Link to Pull Request: https://github.com/jenkinsci/jenkins/pull/1598

          lior hasson added a comment -

          Hey,
          Any ETA about this issue?

          lior hasson added a comment - Hey, Any ETA about this issue?

          Code changed in jenkins
          User: liorha
          Path:
          core/src/main/java/hudson/util/MaskingClassLoader.java
          test/src/test/java/hudson/ClassicPluginStrategyTest.java
          test/src/test/resources/hudson/ClassicPluginStrategyTest/testMaskResourceClassLoader.zip
          http://jenkins-ci.org/commit/jenkins/7db618e64a8b70514df227dd706566e93a0e112c
          Log:
          JENKINS-27289

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: core/src/main/java/hudson/util/MaskingClassLoader.java test/src/test/java/hudson/ClassicPluginStrategyTest.java test/src/test/resources/hudson/ClassicPluginStrategyTest/testMaskResourceClassLoader.zip http://jenkins-ci.org/commit/jenkins/7db618e64a8b70514df227dd706566e93a0e112c Log: JENKINS-27289

          Code changed in jenkins
          User: liorha
          Path:
          changelog.html
          cli/pom.xml
          core/pom.xml
          plugins/pom.xml
          pom.xml
          test/pom.xml
          war/pom.xml
          http://jenkins-ci.org/commit/jenkins/6428d15aae54d5716fc34ace386fc87bfcb031a0
          Log:
          Merge branch 'master' into JENKINS-27289

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: changelog.html cli/pom.xml core/pom.xml plugins/pom.xml pom.xml test/pom.xml war/pom.xml http://jenkins-ci.org/commit/jenkins/6428d15aae54d5716fc34ace386fc87bfcb031a0 Log: Merge branch 'master' into JENKINS-27289

          Code changed in jenkins
          User: liorha
          Path:
          changelog.html
          core/src/main/java/hudson/model/Run.java
          core/src/main/java/hudson/tasks/Maven.java
          core/src/test/java/hudson/model/RunTest.java
          war/pom.xml
          http://jenkins-ci.org/commit/jenkins/e166c9268e3cffbe8eab1d7a7502ac272b325a02
          Log:
          Merge branch 'master' into JENKINS-27289

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: changelog.html core/src/main/java/hudson/model/Run.java core/src/main/java/hudson/tasks/Maven.java core/src/test/java/hudson/model/RunTest.java war/pom.xml http://jenkins-ci.org/commit/jenkins/e166c9268e3cffbe8eab1d7a7502ac272b325a02 Log: Merge branch 'master' into JENKINS-27289

          Code changed in jenkins
          User: liorha
          Path:
          changelog.html
          core/src/main/java/hudson/model/Computer.java
          core/src/main/java/hudson/slaves/SlaveComputer.java
          test/src/test/java/hudson/model/ComputerTest.java
          http://jenkins-ci.org/commit/jenkins/a503b66977e3058cdd54f1701c248cc864d9e36c
          Log:
          Merge branch 'master' into JENKINS-27289

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: changelog.html core/src/main/java/hudson/model/Computer.java core/src/main/java/hudson/slaves/SlaveComputer.java test/src/test/java/hudson/model/ComputerTest.java http://jenkins-ci.org/commit/jenkins/a503b66977e3058cdd54f1701c248cc864d9e36c Log: Merge branch 'master' into JENKINS-27289

          Code changed in jenkins
          User: Jesse Glick
          Path:
          changelog.html
          core/src/main/java/hudson/util/MaskingClassLoader.java
          test/src/test/java/hudson/ClassicPluginStrategyTest.java
          test/src/test/resources/hudson/ClassicPluginStrategyTest/testMaskResourceClassLoader.zip
          http://jenkins-ci.org/commit/jenkins/caedb49c23f2ec24dae9c28f8a604864dc1fbb3e
          Log:
          JENKINS-27289 Noting merge of #1598.

          Compare: https://github.com/jenkinsci/jenkins/compare/0d553783fdfe...caedb49c23f2

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html core/src/main/java/hudson/util/MaskingClassLoader.java test/src/test/java/hudson/ClassicPluginStrategyTest.java test/src/test/resources/hudson/ClassicPluginStrategyTest/testMaskResourceClassLoader.zip http://jenkins-ci.org/commit/jenkins/caedb49c23f2ec24dae9c28f8a604864dc1fbb3e Log: JENKINS-27289 Noting merge of #1598. Compare: https://github.com/jenkinsci/jenkins/compare/0d553783fdfe...caedb49c23f2

          Jesse Glick added a comment -

          Fixed for getResource as called by Which.classFileUrl. Still need a fix for getResources, but that should not block merging to LTS.

          Jesse Glick added a comment - Fixed for getResource as called by Which.classFileUrl . Still need a fix for getResources , but that should not block merging to LTS.

          Daniel Beck added a comment -

          jglick Only resolved/closed issues qualify for LTS inclusion (or talk to Oliver and show him this issue)

          Daniel Beck added a comment - jglick Only resolved/closed issues qualify for LTS inclusion (or talk to Oliver and show him this issue)

          Jesse Glick added a comment -

          IMO the original fix to getResource can be merged into stable-1.609 without considering the soak period for the getResources addition.

          Jesse Glick added a comment - IMO the original fix to getResource can be merged into stable-1.609 without considering the soak period for the getResources addition.

          Code changed in jenkins
          User: liorha
          Path:
          core/src/main/java/hudson/util/MaskingClassLoader.java
          http://jenkins-ci.org/commit/jenkins/40e75129f40675f8a71b489b38c5911b37cb8559
          Log:
          Contine the JENKINS-27289 ticket: update the getResources as well

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: core/src/main/java/hudson/util/MaskingClassLoader.java http://jenkins-ci.org/commit/jenkins/40e75129f40675f8a71b489b38c5911b37cb8559 Log: Contine the JENKINS-27289 ticket: update the getResources as well

          Code changed in jenkins
          User: liorha
          Path:
          changelog.html
          war/src/main/webapp/css/style.css
          http://jenkins-ci.org/commit/jenkins/dc23c1120d7758a9288c418b49ab887309fa5e62
          Log:
          Merge branch 'master' into JENKINS-27289-update

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: changelog.html war/src/main/webapp/css/style.css http://jenkins-ci.org/commit/jenkins/dc23c1120d7758a9288c418b49ab887309fa5e62 Log: Merge branch 'master' into JENKINS-27289 -update

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/hudson/util/MaskingClassLoader.java
          http://jenkins-ci.org/commit/jenkins/f3f8abd36bdd60d2d85c9cd5a9f2555640dd53a1
          Log:
          Merge pull request #1725 from liorhson/JENKINS-27289-update

          Contine the JENKINS-27289 ticket: update the getResources as well

          Compare: https://github.com/jenkinsci/jenkins/compare/a013c033685d...f3f8abd36bdd

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/hudson/util/MaskingClassLoader.java http://jenkins-ci.org/commit/jenkins/f3f8abd36bdd60d2d85c9cd5a9f2555640dd53a1 Log: Merge pull request #1725 from liorhson/ JENKINS-27289 -update Contine the JENKINS-27289 ticket: update the getResources as well Compare: https://github.com/jenkinsci/jenkins/compare/a013c033685d...f3f8abd36bdd

          Code changed in jenkins
          User: liorha
          Path:
          core/src/main/java/hudson/util/MaskingClassLoader.java
          test/src/test/java/hudson/ClassicPluginStrategyTest.java
          test/src/test/resources/hudson/ClassicPluginStrategyTest/testMaskResourceClassLoader.zip
          http://jenkins-ci.org/commit/jenkins/0612d94092ebffa8733bb84097c5cd896dd5059c
          Log:
          JENKINS-27289

          (cherry picked from commit 7db618e64a8b70514df227dd706566e93a0e112c)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: core/src/main/java/hudson/util/MaskingClassLoader.java test/src/test/java/hudson/ClassicPluginStrategyTest.java test/src/test/resources/hudson/ClassicPluginStrategyTest/testMaskResourceClassLoader.zip http://jenkins-ci.org/commit/jenkins/0612d94092ebffa8733bb84097c5cd896dd5059c Log: JENKINS-27289 (cherry picked from commit 7db618e64a8b70514df227dd706566e93a0e112c)

          Daniel Beck added a comment -

          Partial bugfix from May was backported towards 1.609.2 as a last minute fix. The rest is still an lts-candidate for 1.609.3.

          Daniel Beck added a comment - Partial bugfix from May was backported towards 1.609.2 as a last minute fix. The rest is still an lts-candidate for 1.609.3.

          Backported as a whole into 1.609.2

          Oliver Gondža added a comment - Backported as a whole into 1.609.2

          Code changed in jenkins
          User: liorha
          Path:
          core/src/main/java/hudson/util/MaskingClassLoader.java
          http://jenkins-ci.org/commit/jenkins/0fcb58813b78cf698726a4987e8edcedea130acd
          Log:
          Contine the JENKINS-27289 ticket: update the getResources as well

          (cherry picked from commit 40e75129f40675f8a71b489b38c5911b37cb8559)

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: liorha Path: core/src/main/java/hudson/util/MaskingClassLoader.java http://jenkins-ci.org/commit/jenkins/0fcb58813b78cf698726a4987e8edcedea130acd Log: Contine the JENKINS-27289 ticket: update the getResources as well (cherry picked from commit 40e75129f40675f8a71b489b38c5911b37cb8559)

          Code changed in jenkins
          User: Aiden Scandella
          Path:
          pom.xml
          http://jenkins-ci.org/commit/phabricator-plugin/67700d9f7cfab3097b85141d8f8a63111fc006bd
          Log:
          Fix Apache HTTP class clashing

          Need fix from: https://issues.jenkins-ci.org/browse/JENKINS-27289

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Aiden Scandella Path: pom.xml http://jenkins-ci.org/commit/phabricator-plugin/67700d9f7cfab3097b85141d8f8a63111fc006bd Log: Fix Apache HTTP class clashing Need fix from: https://issues.jenkins-ci.org/browse/JENKINS-27289

            liorha lior hasson
            liorha lior hasson
            Votes:
            4 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: