openshift / jenkins-plugin

Apache License 2.0
81 stars 50 forks source link

okhttp binary changes break plugin when others installed #147

Closed carlossg closed 7 years ago

carlossg commented 7 years ago

okhttp3 3.5 broke binary compatibility and because 3.7 is being used in kubernetes-plugin and kubernetes-client if you have this plugin installed you'll get errors

https://github.com/square/okhttp/blob/master/CHANGELOG.md#version-350

Should be fixed by upgrading to 3.5+

java.lang.LinkageError: loader constraint violation: loader (instance of 
hudson/PluginFirstClassLoader) previously initiated loading for a different 
type with name "okhttp3/Request" 
at java.lang.ClassLoader.defineClass1(Native Method) 
at java.lang.ClassLoader.defineClass(ClassLoader.java:763) 
at org.apache.tools.ant.AntClassLoader.defineClassFromData 
(AntClassLoader.java:1128) 
at org.apache.tools.ant.AntClassLoader.getClassFromStream 
(AntClassLoader.java:1299) 
at org.apache.tools.ant.AntClassLoader.findClassInComponents 
(AntClassLoader.java:1355) 
at org.apache.tools.ant.AntClassLoader.findClass 
(AntClassLoader.java:1315) 
at org.apache.tools.ant.AntClassLoader.loadClass 
(AntClassLoader.java:1074) 
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
at okhttp3.ws.WebSocketCall.<init>(WebSocketCall.java:58) 
at okhttp3.ws.WebSocketCall.<init>(WebSocketCall.java:54) 
at okhttp3.ws.WebSocketCall.create(WebSocketCall.java:46) 
at 
com.openshift.internal.restclient.capability.resources.PodLogRetrievalAsync.start 
gabemontero commented 7 years ago

thanks for the intel @carlossg

so, some additional details from poking around various repos

1) for the openshift jenkins image, we are pulling in v0.10 of the kubernetes-plugin, and is what we test with

So users are either independently installing the plugins, or possibly took the openshift jenkins image and upgraded the kubernetes-plugin

2) for v0.10, I believe that translates to v1.4.27 of the fabric8 k8s-client, if I read https://github.com/jenkinsci/kubernetes-plugin/blob/21d97779a575f018afb019deaa6a77821d16270a/pom.xml correctly

3) I couldn't find a precise v1.4.27 branch in fabric8 k8s-client repo, but the closest v1.4.x branch I found listed okhttp 3.4.1 ... that also matches the okhttp jars I see in the v0.10 k8s plugin hpi file

4) And yes, this repo current cites okhttp3 3.3.1

5) note, the openshift-sync plugin current cites 2.1.2 of fabric8's openshift-client, which pulls in okhttp3 3.4.2

Most likely when I bump things, I should coordinate this plugin, the openshift sync plugin, and the version of the kubernetes-plugin the openshift jenkis image uses to

@bparees @jstrachan @iocanel FYI

any thoughts folks?

thanks

carlossg commented 7 years ago

I think user just clicked the "update all plugins" button, which got them the kubernetes-plugin 0.12

0.13 should be out soon with fixes

gabemontero commented 7 years ago

Oh, I forgot, the openshift-restclient-java dependency of this plugin also uses okhttp3

It is currently pulling in 3.3.1 (which is why this plugin is at that version) ... we'll most likely need to coordinate there as well ... @jcantrill FYI

gabemontero commented 7 years ago

On Thu, Aug 10, 2017 at 9:55 AM, Carlos Sanchez notifications@github.com wrote:

I think user just clicked the "update all plugins" button, which got them the kubernetes-plugin 0.12

Yep that would cause it too ... thanks for the clarification

0.13 should be out soon with fixes

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/openshift/jenkins-plugin/issues/147#issuecomment-321558034, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbadC55TTxzYsQLRL9YvYPX8QrrcpsHks5sWwvAgaJpZM4OzH-D .

GolanTrevize10 commented 7 years ago

Hi I got the same problem. I'm using a Jenkins instance outside Openshift with Openshift plugin version 1.0.48 and kubernetes plugin 0.12. Should I downgrade to 0.10?

gabemontero commented 7 years ago

On Thu, Aug 10, 2017 at 9:59 AM, GolanTrevize10 notifications@github.com wrote:

Hi I got the same problem. I'm using a Jenkins instance outside Openshift with Openshift plugin version 1.0.48 and kubernetes plugin 0.12. Should I downgrade to 0.10?

That would resolve it in the interim, yes.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/openshift/jenkins-plugin/issues/147#issuecomment-321559418, or mute the thread https://github.com/notifications/unsubscribe-auth/ADbadNEOuQP2BqnoiYwdW1AhWKbDYtjYks5sWwzdgaJpZM4OzH-D .

GolanTrevize10 commented 7 years ago

Ok I downgraded to 0.11 and it iis working

scoheb commented 7 years ago

Hi,

I was able to get around this by including this:

<plugins>
  <plugin>
  <groupId>org.jenkins-ci.tools</groupId>
  <artifactId>maven-hpi-plugin</artifactId>
  <configuration>
    <pluginFirstClassLoader>true</pluginFirstClassLoader>
  </configuration>
</plugin>

in the pom.xml for openshift/jenkins-plugin.

I rebuilt and re-installed the plugin and things worked.

My environment has:

gabemontero commented 7 years ago

Thanks for the investigation @scoheb !!

For folks who are interested, background on that pom setting: https://wiki.jenkins.io/display/JENKINS/Plugin+Structure

After a couple of minutes of thought, I'm thinking the 2 changes 1) @scoheb change 2) the broader bump of the okhttp3 versions previously outlined

are not mutually exclusive. If need be, we employ 1) as a tactical fix if users' manual upgrade of k8s plugin proliferates and the pain experienced gets to be too much, but we still pursue 2) as the okhttp3 used with some of the plugins and their dependencies are getting old.

Opinions of course welcome

bparees commented 7 years ago

makes sense to me

gabemontero commented 7 years ago

bumping okhttp is even more complicated that first thought, given it appears okhttp-ws was in fact deprecated

more restructuring of the restclient would be needed, given where it is at from a future dev perspective, don't see that happening

given https://github.com/openshift/jenkins-plugin/pull/148 isolates this plugin and addresses the original concern (we in fact have updated the openshift jenkins image to 1.0 of k8s plugin), I'm closing this as fixed