manusa/yakc

Running the sample Pod Logs code: java.lang.IllegalStateException: cannot make a new request because the previous response is still open: please call response.close()

sebastienratez opened this issue · 1 comments

final Configuration configuration = Configuration.builder().username(new ConfigurationSupplier<String>() {
            @Override
            public String get() throws IOException {
                return "arn:aws:eks...";
            }
        }).server("https://....us-east-1.eks.amazonaws.com")
            .certificateAuthorityData("...=")
            .namespace("...")
            .token(new ConfigurationSupplier<String>() {
                @Override
                public String get() throws IOException {
                    return "...";
                }
            }).build();

        try (KubernetesClient kc = new KubernetesClient(configuration)) {
            final CoreV1Api api = kc.create(CoreV1Api.class);

            final KubernetesCall<String> podLogCall = api.readNamespacedPodLog(this.podName, this.namespace, new CoreV1Api.ReadNamespacedPodLog().follow(false).pretty("false").timestamps(true));
            System.out.println(podLogCall.get());
        } catch (Exception ex) {
            ex.printStackTrace();
        }

podLogCall.get() fails:


java.lang.IllegalStateException: cannot make a new request because the previous response is still open: please call response.close()
        at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:164)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
        at com.marcnuri.yakc.config.OkHttpClientConfigurator.lambda$initOkHttpClient$2(OkHttpClientConfigurator.java:90)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
        at com.marcnuri.yakc.config.OkHttpClientConfigurator.lambda$initOkHttpClient$1(OkHttpClientConfigurator.java:84)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
        at okhttp3.RealCall.execute(RealCall.java:81)
        at com.marcnuri.yakc.retrofit.KubernetesHttpCall.executeRaw(KubernetesHttpCall.java:107)
        at com.marcnuri.yakc.retrofit.KubernetesHttpCall.get(KubernetesHttpCall.java:68)
        at com.marcnuri.yakc.retrofit.KubernetesHttpCall.get(KubernetesHttpCall.java:63)
        at com.personetics.sa.bundletool.readers.PodStreamReader.readAndParseLogStream(PodStreamReader.java:48)
        at com.personetics.sa.bundletool.parsers.RequestEventsParser.startProcess(RequestEventsParser.java:34)
        at com.personetics.sa.bundletool.Main.main(Main.java:24)

Using version

0.0.28

of the libraries.

Possibly you need to upgrade the okhttp library to v4... I could see issues reported there that were no longer addressed because of v3 in use. Are you still maintaining this project?

Edit: I have added the newer dep manually to my pom:


<dependency>
    <groupId>com.squareup.okhttp3</groupId>
    <artifactId>okhttp</artifactId>
    <version>4.12.0</version>
</dependency>

And the error disappeared.