fabric8io / mockwebserver

An extension of okhttp's mockwebserver, that provides a DSL and is easier to use
Apache License 2.0
113 stars 38 forks source link

Update OkHttp to 4.2.2 #47

Closed tobiasstadler closed 4 years ago

tobiasstadler commented 4 years ago

@oscerd Thank you for you're review. Could please merge and release it?

tobiasstadler commented 4 years ago

Can anyone merge this?

oscerd commented 4 years ago

@rohanKanojia can we release this?

rohanKanojia commented 4 years ago

@oscerd : Yes, I would release it. But Isn't okhttp 4 based on kotlin( see https://github.com/square/okhttp/issues/4723) ? I think we should check whether it could be breaking something in k8s-client.

manusa commented 4 years ago

OkHttp version should be the same in kuberenetes-client and mockwebserver.

We are getting issues in other projects (FMP, JKube, etc.) due to the version mismatch:

INFO: MockWebServer[47139] received request: GET /api/v1/namespaces/test/pods/myapp-build/log?pretty=false&follow=true HTTP/1.1 and responded: HTTP/1.1 404 Client Error
Exception in thread "MockWebServer" java.lang.NoSuchMethodError: okhttp3.internal.ws.RealWebSocket.<init>(Lokhttp3/Request;Lokhttp3/WebSocketListener;Ljava/util/Random;)V
        at okhttp3.mockwebserver.MockWebServer.handleWebSocketUpgrade(MockWebServer.java:670)
        at okhttp3.mockwebserver.MockWebServer.access$1700(MockWebServer.java:99)
        at okhttp3.mockwebserver.MockWebServer$3.processOneRequest(MockWebServer.java:517)
        at okhttp3.mockwebserver.MockWebServer$3.processConnection(MockWebServer.java:457)
        at okhttp3.mockwebserver.MockWebServer$3.execute(MockWebServer.java:396)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

For FMP, you can easily reproduce this when trying the fabric8:watch goal:

[ERROR] F8: An error has occurred while while trying to watch the resources [devtools needs to be included in fat jar]
[INFO] ------------------------------------------------------------------------
[empt
ion in thread "Thread-6" java.lang.NoClassDefFoundError: okhttp3/internal/ws/WebSocketProtocol
        at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:415)
        at okhttp3.internal.ws.RealWebSocket.close(RealWebSocket.java:411)
        at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager.closeWebSocket(WatchConnectionManager.java:374)
        at io.fabric8.kubernetes.client.dsl.internal.WatchConnectionManager.close(WatchConnectionManager.java:348)
        at io.fabric8.maven.core.service.PortForwardService.lambda$forwardPortAsync$0(PortForwardService.java:170)
        at io.fabric8.maven.core.service.PortForwardService$3.run(PortForwardService.java:181)
Caused by: java.lang.ClassNotFoundException: okhttp3.internal.ws.WebSocketProtocol
        at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
        at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
        ... 6 more

@tobiasstadler why was this change needed? If this was something necessary, we should try to update to latest OkHttp in Kubernetes Client too, else, we should revert and update the OkHttp version to that which is referenced in Kubernetes-Client.

cc @rohanKanojia @oscerd

Relates to: eclipse/jkube#148 eclipse/jkube#136

rohanKanojia commented 4 years ago

we haven't released a new version of mockwebserver with 4.2.2 okhttp version

manusa commented 4 years ago

Ok, didn't actually check OkHttp in latest release version.

I'll submit a PR with OkHttp version upgrade to 3.12.6 (Kubernetes-Client)