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

LogsExample displayed error in k8s v1.6.7 #103

Closed
AssafKatz3 opened this issue Oct 24, 2017 · 5 comments
Closed

LogsExample displayed error in k8s v1.6.7 #103

AssafKatz3 opened this issue Oct 24, 2017 · 5 comments

Comments

@AssafKatz3
Copy link

AssafKatz3 commented Oct 24, 2017

Hi,
I am trying to run it on v1.6.7 and get:
Exception in thread "main" java.net.SocketTimeoutException: timeout
at okio.Okio$3.newTimeoutException(Okio.java:207)
at okio.AsyncTimeout.exit(AsyncTimeout.java:261)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:215)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:306)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:300)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:196)
at com.squareup.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:186)
at com.squareup.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:127)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:87)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:722)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:576)
at com.squareup.okhttp.Call.getResponse(Call.java:287)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
at com.squareup.okhttp.Call.execute(Call.java:80)
at io.kubernetes.client.PodLogs.streamNamespacedPodLog(PodLogs.java:80)
at io.kubernetes.client.PodLogs.streamNamespacedPodLog(PodLogs.java:72)
at io.kubernetes.client.PodLogs.streamNamespacedPodLog(PodLogs.java:66)
at io.kubernetes.client.examples.LogsExample.main(LogsExample.java:49)
Caused by: java.net.SocketException: Socket closed
at java.net.SocketInputStream.read(SocketInputStream.java:204)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465)
at sun.security.ssl.InputRecord.read(InputRecord.java:503)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:940)
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105)
at okio.Okio$2.read(Okio.java:139)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:211)
... 17 more
And similar error when I am running it from maven.
This error is displayed immediately if the pod doesn't have any log or have multi containers, otherwise it is displayed after the log.
Thanks,
Assaf

@AssafKatz3 AssafKatz3 changed the title LogsExample not works with k8s v1.6.7 LogsExample displayed error in k8s v1.6.7 Oct 24, 2017
@lwander
Copy link
Contributor

lwander commented Oct 25, 2017

Have you tried this against other k8s cluster versions?

@AssafKatz3
Copy link
Author

I didn't, I have only this version. I am using the 1.0.0-beta2-SNAPSHOT version

@brendandburns
Copy link
Contributor

This looks to me like your kubernetes cluster isn't available on the network. Do any of the other examples work? Does kubectl work?

@AssafKatz3
Copy link
Author

The logs example is connected to k8s since I can see the log until it is failing. kubectl logs ... is working well.

@brendandburns
Copy link
Contributor

Ah, well in that case, this is the underlying Java socket timing out.

You need to do

ApiClient client = ...;
client.getHttpClient().setConnectTimeout(value, TimeUnit.SECONDS);
client.getHttpClient().setReadTimeout(value, TimeUnit.SECONDS);
client.getHttpClient().setWriteTimeout(value, TimeUnit.SECONDS);

Where value is your desired timeout.

Note that this will apply to all requests from that client so be careful.

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

3 participants