Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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() #86

Open
sebastienratez opened this issue Jul 11, 2024 · 1 comment

Comments

@sebastienratez
Copy link

sebastienratez commented Jul 11, 2024

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.

@sebastienratez
Copy link
Author

sebastienratez commented Jul 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant