EOFException when there is no HTTP response
See original GitHub issueI am getting the following exception when the server is down and there is no response for the request.
java.io.IOException: unexpected end of stream on Connection{rh7v-intel64-90-java-stress-4.marklogic.com:8000, proxy=DIRECT hostAddress=rh7v-intel64-90-java-stress-4.marklogic.com/172.18.132.248:8000 cipherSuite=none protocol=http/1.1}
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:205)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at com.burgstaller.okhttp.AuthenticationCacheInterceptor.intercept(AuthenticationCacheInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at okhttp3.RealCall.execute(RealCall.java:69)
at com.marklogic.client.impl.OkHttpServices.sendRequestOnce(OkHttpServices.java:674)
... 13 more
Caused by: java.io.EOFException: \n not found: limit=0 content=…
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:227)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSurce.java:211)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
... 32 more
Capturing the trace in wireshark shows that the request has been sent but the server doesn’t respond, not even a status code. In that case, I am getting this exception which is very misleading. It would be good to have a more appropriate exception for cases where there is no response from the server. Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (2 by maintainers)
Top Results From Across the Web
How to avoid EOFException for an empty HTTP response from ...
If responseStream.available() > 0 is not an option, it means that the stream actually contains something, but that stream seems to be incomplete...
Read more >How to Fix the EOFException in Java.io - Rollbar
EOFException is a checked exception in Java that occurs when an end of file or end of stream is reached unexpectedly during input....
Read more >Response.java
When all modules have handled the response then the HTTPResponse * fills in its ... the message length of the response if either...
Read more >Web service with no records fails with error as below:
I want to make use of choice Property to decide if or not data is present in source/web service. But it throws below...
Read more >EOFException (Java Platform SE 7 ) - Oracle Help Center
Signals that an end of file or end of stream has been reached unexpectedly during input. This exception is mainly used by data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, Yuri and Jesse, for the due diligence.
@sammefford @vivekmuniyandi how did you resolve the issue?