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

okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR/ CANCEL #3955

Open
sealiasheq opened this issue Apr 4, 2018 · 55 comments
Labels
android Relates to usage specifically on Android bug Bug in existing code
Milestone

Comments

@sealiasheq
Copy link

I am connecting to web service with last version retrofit but get me bellow error :

okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR

My code is like bellow :

try {
                    // Create a trust manager that does not validate certificate chains
                    final TrustManager[] trustAllCerts = new TrustManager[]{
                            new X509TrustManager() {
                                @Override
                                public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
                                }

                                @Override
                                public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException {
                                }

                                @Override
                                public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                                    return new java.security.cert.X509Certificate[]{};
                                }
                            }
                    };

                    // Install the all-trusting trust manager
                    final SSLContext sslContext = SSLContext.getInstance("SSL");
                    sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
                    // Create an ssl socket factory with our all-trusting manager
                    final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
                    OkHttpClient.Builder builder = new OkHttpClient.Builder();
                    builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]);
                    builder.hostnameVerifier(new HostnameVerifier() {
                        @Override
                        public boolean verify(String hostname, SSLSession session) {
                            return true;
                        }
                    });

                    OkHttpClient okHttpClient = builder.
                            build();
                    Retrofit retrofit = new Retrofit.Builder()
                            .baseUrl("https://xxx")
                            .client(okHttpClient)
                            .addConverterFactory(GsonConverterFactory.create())
                            .addConverterFactory(ScalarsConverterFactory.create())
                            .build();
                    final PublicApi request = retrofit.create(PublicApi.class);
                    Call<GetStatusSaveContactListModel> call = request.sendContactLists("saveContactList", obj.toString());
                    call.enqueue(new Callback<GetStatusSaveContactListModel>() {
                        @Override
                        public void onResponse(@NonNull Call<GetStatusSaveContactListModel> call, @NonNull Response<GetStatusSaveContactListModel> response) {
                        }

                        @Override
                        public void onFailure(@NonNull Call<GetStatusSaveContactListModel> call, Throwable t) {
                        }
                    });

                } catch (Exception e) {
                    throw new RuntimeException(e);
                }

And

@POST("/web_service/mobile/rest")
Call<GetStatusSaveContactListModel> sendContactLists(@Query("function") String function,
                                                     @Query("data") String data);

And

implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
@sealiasheq sealiasheq changed the title okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR/ CANCEL Apr 4, 2018
@osama415
Copy link

osama415 commented Apr 4, 2018

yes, I am facing same issues, is there any solution yet?

@owen5586331
Copy link

i am also facing this issue
Exception occurs at okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR at okhttp3.internal.http2.Http2Stream$FramingSource.checkNotClosed(Http2Stream.java:436) at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.java:338) at okio.ForwardingSource.read(ForwardingSource.java:35) at okio.RealBufferedSource.read(RealBufferedSource.java:46) at okhttp3.internal.cache.CacheInterceptor$1.read(CacheInterceptor.java:174) at okio.RealBufferedSource$1.read(RealBufferedSource.java:430) at java.io.InputStream.read(InputStream.java:101)

@swankjesse
Copy link
Member

This isn’t actionable as-is. Could you provide the server URL that triggers this? Or a test case that reproduces?

@swankjesse swankjesse added needs info More information needed from reporter bug Bug in existing code labels Jul 5, 2018
@swankjesse swankjesse added this to the Icebox milestone Jul 5, 2018
@karussell
Copy link

karussell commented Nov 9, 2018

We are seeing the same issue with (openjdk version "11" 2018-09-25) and it is related to #3146, i.e. something with http/2.

We tried versions from 3.11.0 down to 3.3.0 and only 3.2.0 works for us. The strange thing is that sometimes we get this PROTOCOL_ERROR, but sometimes also http2.ConnectionShutdownException: null:

Caused by: okhttp3.internal.http2.ConnectionShutdownException: null
        at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.java:247)
        at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.java:230)
        at okhttp3.internal.http2.Http2Codec.writeRequestHeaders(Http2Codec.java:113)
        at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:50)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
        at okhttp3.RealCall.execute(RealCall.java:77)

And sometimes stream cancel:

Caused by: okhttp3.internal.framed.StreamResetException: stream was reset: CANCEL
        at okhttp3.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:145)
        at okhttp3.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:149)
        at okhttp3.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:775)
        at okhttp3.internal.http.HttpEngine.access$200(HttpEngine.java:86)
        at okhttp3.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:760)
        at okhttp3.internal.http.HttpEngine.readResponse(HttpEngine.java:613)
        at okhttp3.RealCall.getResponse(RealCall.java:244)
        at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:201)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:163)
        at okhttp3.RealCall.execute(RealCall.java:57)

Also this is a rather rare issue but for certain requests reproducable. We'll try to produce a failing test for the latest 3.11.0

danielnorberg pushed a commit to spotify/styx that referenced this issue Nov 12, 2018
danielnorberg pushed a commit to spotify/styx that referenced this issue Nov 12, 2018
danielnorberg pushed a commit to spotify/styx that referenced this issue Nov 13, 2018
@psohm
Copy link

psohm commented Feb 3, 2019

I have the same problem with okhttp3.12 retrofit 2
The server is in golang 1.11.5 (gorilla/mux and I try also chi)
My use case is to enqueue about 100 query, I have about 20% of the query which have a protocol_error

okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR
2019-02-03 23:52:09.691c W/System.err: at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.java:158)
2019-02-03 23:52:09.691c W/System.err: at okhttp3.internal.http2.Http2Codec.readResponseHeaders(Http2Codec.java:131)
2019-02-03 23:52:09.691c W/System.err: at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
2019-02-03 23:52:09.691c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-02-03 23:52:09.692c W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
2019-02-03 23:52:09.692c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-02-03 23:52:09.692c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-02-03 23:52:09.693c W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
2019-02-03 23:52:09.693c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-02-03 23:52:09.693c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-02-03 23:52:09.693c W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
2019-02-03 23:52:09.693c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-02-03 23:52:09.694c W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
2019-02-03 23:52:09.694c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-02-03 23:52:09.694c W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-02-03 23:52:09.695c W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
2019-02-03 23:52:09.696c W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
2019-02-03 23:52:09.696c W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2019-02-03 23:52:09.696c W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2019-02-03 23:52:09.696c W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2019-02-03 23:52:09.696c W/System.err: at java.lang.Thread.run(Thread.java:764)

@swankjesse
Copy link
Member

Can you enable HTTP/2 frame logging and try again?

  private static void enableHttp2FrameLogging() {
    frameLogger = Logger.getLogger(Http2.class.getName());
    frameLogger.setLevel(Level.FINE);
    ConsoleHandler handler = new ConsoleHandler();
    handler.setLevel(Level.FINE);
    handler.setFormatter(new SimpleFormatter() {
      @Override public String format(LogRecord record) {
        return Util.format("%s%n", record.getMessage());
      }
    });
    frameLogger.addHandler(handler);
  }
}

@psohm
Copy link

psohm commented Feb 4, 2019

tks for your very quick answer
you can find the full log on https://pastebin.com/5rj2kQHL
I hope you will find what is wrong
I can also provide the go server and the java code if needed

My query is a POST always on the same URL
it contains a JSON Body
and there is an authorization bearer in the header

I also tryied to remove the header (the autorisation bearer), it doesn't work also.

@swankjesse
Copy link
Member

Yep, that'd be handy. As small as you can make it please.

@psohm
Copy link

psohm commented Feb 4, 2019

I set up for you a server with the golang server
the endpoint is https://myvoip.w3france.com:10443/item/2 in POST
For reasons I can't explain, there are less protocol problem with the server (about 3/4%) vs my dev machine on the same wifi network
(in that case I use 4G)
And last information, I have a OnePlus 5T with Android 9. Didn't try it from other device.

Retrofit.Builder builder =
                new Retrofit.Builder()
                        .baseUrl("https://myvoip.w3france.com:10443/")
                        .addConverterFactory(GsonConverterFactory.create());

        OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
        httpClient.protocols(Arrays.asList(Protocol.HTTP_2, Protocol.HTTP_1_1));
        Retrofit retrofit = builder.client(httpClient.build()).build();

        AuthService service = retrofit.create(AuthService.class);

        // iterate over each item of the nomtable
        for (int i = 0; i < 500; i  ) {
                final String id = Integer.toString(i);

                RequestBody body = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), "");

                Call<String> call = service.sendItem(id, body);

                call.enqueue(new Callback<String>() {
                    @Override
                    public void onResponse(Call<String> call, Response<String> response) {
                        Log.d(TAG, "Success "   id);

                    }

                    @Override
                    public void onFailure(Call<String> call, Throwable t) {
                        Log.d(TAG, "Failure "   id);
                        Log.d(TAG, t.getMessage());
                        t.printStackTrace();
                    }
                });
        }

and AuthService.java

import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Path;

public interface AuthService {
    @POST("item/{item}")
    Call<String> sendItem(
            @Path("item") String itemGuid,
            @Body RequestBody body);
}

@c0dehunter
Copy link

c0dehunter commented Feb 28, 2019

Having the same issue; it happens always when there is bad connection (e.g. using 2G with bad signal). Trying to retrieve a JSON of ~80kB on 2G. I am using retrofit:2.5.0.

2019-02-28 14:14:34.304 22789-22789/? W/System.err: okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR
2019-02-28 14:14:34.305 22789-22789/? W/System.err:     at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.java:420)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okhttp3.internal.http2.Http2Codec$StreamFinishingSource.read(Http2Codec.java:205)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.RealBufferedSource.read(RealBufferedSource.java:47)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.RealBufferedSource.exhausted(RealBufferedSource.java:57)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.InflaterSource.refill(InflaterSource.java:102)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.InflaterSource.read(InflaterSource.java:62)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.GzipSource.read(GzipSource.java:80)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.RealBufferedSource.read(RealBufferedSource.java:47)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.ForwardingSource.read(ForwardingSource.java:35)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at retrofit2.OkHttpCall$ExceptionCatchingResponseBody$1.read(OkHttpCall.java:296)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okio.RealBufferedSource$1.read(RealBufferedSource.java:439)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:288)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:351)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at java.io.InputStreamReader.read(InputStreamReader.java:184)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at okhttp3.ResponseBody$BomAwareReader.read(ResponseBody.java:259)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1295)
2019-02-28 14:14:34.307 22789-22789/? W/System.err:     at com.google.gson.stream.JsonReader.nextQuotedValue(JsonReader.java:1030)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.stream.JsonReader.nextString(JsonReader.java:815)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:402)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.internal.bind.TypeAdapters$16.read(TypeAdapters.java:390)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
2019-02-28 14:14:34.308 22789-22789/? W/System.err:     at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:82)
2019-02-28 14:14:34.309 22789-22789/? W/System.err:     at com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter.read(CollectionTypeAdapterFactory.java:61)
2019-02-28 14:14:34.309 22789-22789/? W/System.err:     at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
2019-02-28 14:14:34.309 22789-22789/? W/System.err:     at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
2019-02-28 14:14:34.309 22789-22789/? W/System.err:     at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:223)
2019-02-28 14:14:34.309 22789-22789/? W/System.err:     at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
2019-02-28 14:14:34.310 22789-22789/? W/System.err:     at okhttp3.RealCall$AsyncCall.execute(RealCall.java:206)
2019-02-28 14:14:34.310 22789-22789/? W/System.err:     at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2019-02-28 14:14:34.310 22789-22789/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2019-02-28 14:14:34.311 22789-22789/? W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2019-02-28 14:14:34.311 22789-22789/? W/System.err:     at java.lang.Thread.run(Thread.java:764)

Issue is resolved by using HTTP 1.1 (not a good solution though):

        List<Protocol> protocols = new ArrayList<>();
        protocols.add(Protocol.HTTP_1_1);
        httpClient.protocols(protocols);

@aqibshxhzd
Copy link

Facing the same issue

Logs

2019-08-24 16:51:38.217 30729-30729/com.minimicro.sevenup W/System.err: okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
2019-08-24 16:51:38.217 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http2.Http2Stream.takeResponseHeaders(Http2Stream.java:153)
2019-08-24 16:51:38.217 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http2.Http2Codec.readResponseHeaders(Http2Codec.java:125)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-08-24 16:51:38.218 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
2019-08-24 16:51:38.219 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
2019-08-24 16:51:38.220 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
2019-08-24 16:51:38.220 30729-30729/com.minimicro.sevenup W/System.err: at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
2019-08-24 16:51:38.220 30729-30729/com.minimicro.sevenup W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2019-08-24 16:51:38.220 30729-30729/com.minimicro.sevenup W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2019-08-24 16:51:38.220 30729-30729/com.minimicro.sevenup W/System.err: at java.lang.Thread.run(Thread.java:764)

Lib's
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'
Call
@multipart
@post(EnumsClass.API_URL.addAudit)
Call<First_Audits_Response> AddAuditsForTest(
@part MultipartBody.Part file,
@part MultipartBody.Part file2,
@part MultipartBody.Part file3,
@part MultipartBody.Part file4,
@part MultipartBody.Part file5,
@part MultipartBody.Part file6,
@part("AuditIdByDevice") RequestBody AuditIdByDevice,
@part("AuditBy") RequestBody AuditBy,
);

BuilderClass

static Gson gson = new GsonBuilder()
.setLenient()
.serializeNulls()
.create();

public static Retrofit getClient(String baseUrl, OkHttpClient.Builder okhhtpBuilder) {
    if (retrofit == null) {

        retrofit = new Retrofit.Builder()
                .baseUrl(baseUrl)
                .client(okhhtpBuilder.build())
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }
    return retrofit;
}

@badgroover
Copy link

Any update on this?
StackTrace:

Fatal Exception: okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR
at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.java:158)
at okhttp3.internal.http2.Http2Codec.readResponseHeaders(Http2Codec.java:131)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at ai.beans.driver.networking.NetworkInterceptor.intercept(NetworkInterceptor.kt:22)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:254)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:200)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)

@sandys
Copy link

sandys commented Oct 30, 2019

we are having the same issue.

@ten-skv
Copy link

ten-skv commented Nov 1, 2019

I'm also having the same issue and it is crashing the app.
Caused by okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.java:381)
at okhttp3.internal.http2.Http2Codec$StreamFinishingSource.read(Http2Codec.java:213)
at okio.RealBufferedSource.read(RealBufferedSource.kt:41)
at okhttp3.internal.cache.CacheInterceptor$1.read(CacheInterceptor.java:174)
at okio.RealBufferedSource.read(RealBufferedSource.kt:41)
at okio.ForwardingSource.read(ForwardingSource.kt:29)
at retrofit2.OkHttpCall$ExceptionCatchingRequestBody$1.read(OkHttpCall.java:290)
at okio.RealBufferedSource.request(RealBufferedSource.kt:62)
at com.squareup.moshi.JsonUtf8Reader.nextNonWhitespace(JsonUtf8Reader.java:996)
at com.squareup.moshi.JsonUtf8Reader.doPeek(JsonUtf8Reader.java:309)
at com.squareup.moshi.JsonUtf8Reader.peek(JsonUtf8Reader.java:193)

@baidala
Copy link

baidala commented Nov 8, 2019

faced this issue on Samsung SM-N960F (and 3 other models of Samsung, Android 8). on Xiaomi/Lenovo everything is ok. probably triggered by unstable connection

@balsikandar-okcredit
Copy link

balsikandar-okcredit commented Feb 25, 2020

Have we got any update on this? I get this when i trigger a specific api in quick succession for example:
API called
API called again (before i could get response)
throws StreamResetException

but if i call the API wait for some time i get the response
API called
.
.
. waiting
.
. after some waiting finally i get the response

@mlazowik
Copy link

mlazowik commented Dec 21, 2020

Our users are mostly using networks with poor quality, both in bandwidth and stability. We're using Google's External HTTPS Load Balancer, so I doubt that it was an overloaded server in our case. (I've been following this issue for the past few months, we have dropped clients to HTTP/1.1 for now).

@yschimke
Copy link
Collaborator

yschimke commented Dec 21, 2020

@mlazowik Yep - I'm assuming your case may possibly be the one I mentioned above "Or head of line blocking causing a bunch of later requests to be delayed while HTTP/1.1 may allow small requests to succeed."

@mlazowik
Copy link

I'm guessing you mean something that's described here: https://www.twilio.com/blog/2017/10/http2-issues.html?

@yschimke
Copy link
Collaborator

Nice link. Thanks.

@ishaileshmishra
Copy link

try checking if you have used less time, Increasing time duration solved the problem

.readTimeout(this.timeout, TimeUnit.SECONDS)
.connectTimeout(this.timeout, TimeUnit.SECONDS)
.pingInterval(this.timeout, TimeUnit.MILLISECONDS)
return new OkHttpClient.Builder()
                    //.readTimeout(this.timeout, TimeUnit.SECONDS)
                    //.connectTimeout(this.timeout, TimeUnit.SECONDS)
                    //.pingInterval(200, TimeUnit.MILLISECONDS)
                    .addInterceptor(new HeaderInterceptor(this.authtoken))
                    .retryOnConnectionFailure(true)
                    .build();

@di72nn
Copy link

di72nn commented Apr 19, 2021

I'm getting StreamResetException: stream was reset: CANCEL.

Have anyone checked whether it can be related to query length?

I can reproduce it stably in our use case: we have to use a GET with a very long query. The exception is thrown if the query is longer than 5653 characters, but ok if it is 5863 (I didn't test values in-between).

implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'org.conscrypt:conscrypt-android:2.5.2'

(first noticed in July 2020 with older versions)

The server is nginx (1.14.2).

Stacktrace
    okhttp3.internal.http2.StreamResetException: stream was reset: CANCEL
        at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:148)
        at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.kt:96)
        at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:106)
        at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:79)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at com.facebook.stetho.okhttp3.StethoInterceptor.intercept(StethoInterceptor.java:54)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at wallabag.apiwrapper.TokenRefreshingInterceptor.intercept(TokenRefreshingInterceptor.java:65)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at fr.gaulupeau.apps.Poche.network.WallabagConnection$LoggingInterceptor.intercept(WallabagConnection.java:178)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
        at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
        at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154)
        at retrofit2.OkHttpCall.execute(OkHttpCall.java:188)
        at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:104)
        ...

@HHcola
Copy link

HHcola commented Sep 18, 2021

we are having the same issue.

2021-09-17 16:04:26.979  W/System.err: okhttp3.internal.http2.StreamResetException: stream was reset: PROTOCOL_ERROR
2021-09-17 16:04:26.979  W/System.err:     at okhttp3.internal.http2.Http2Stream$FramingSource.read(Http2Stream.java:381)
2021-09-17 16:04:26.979  W/System.err:     at okhttp3.internal.http2.Http2Codec$StreamFinishingSource.read(Http2Codec.java:213)
2021-09-17 16:04:26.979  W/System.err:     at okio.RealBufferedSource$1.read(RealBufferedSource.java:447)
2021-09-17 16:04:26.979  W/System.err:     at java.io.InputStream.read(InputStream.java:101)
2021-09-17 16:04:26.979  W/System.err:     at com.bumptech.glide.load.model.ComicStreamEncoder.encode(ComicStreamEncoder.kt:46)
2021-09-17 16:04:26.979  W/System.err:     at com.bumptech.glide.load.model.ComicStreamEncoder.encode(ComicStreamEncoder.kt:21)
2021-09-17 16:04:26.979  W/System.err:     at com.bumptech.glide.load.engine.DataCacheWriter.write(DataCacheWriter.java:31)
2021-09-17 16:04:26.979  W/System.err:     at com.bumptech.glide.load.engine.cache.DiskLruCacheWrapper.put(DiskLruCacheWrapper.java:134)
2021-09-17 16:04:26.979  W/System.err:     at com.bumptech.glide.load.engine.SourceGenerator.cacheData(SourceGenerator.java:79)
2021-09-17 16:04:26.980  W/System.err:     at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:46)
2021-09-17 16:04:26.980  W/System.err:     at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
2021-09-17 16:04:26.980  W/System.err:     at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:272)
2021-09-17 16:04:26.980  W/System.err:     at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
2021-09-17 16:04:26.980  W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2021-09-17 16:04:26.980  W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2021-09-17 16:04:26.980  W/System.err:     at java.lang.Thread.run(Thread.java:929)

@dfabreguette
Copy link

We have same issue !

@Oualitsen
Copy link

httpClient.protocols( Collections.singletonList(Protocol.HTTP_1_1) );
This what worked for me.
https://stackoverflow.com/questions/53648852/how-to-solve-okhttp3-internal-http2-streamresetexception-stream-was-reset-refu

@whysqwhw
Copy link

repeat url cancel, cancel not error.

@ly2251
Copy link

ly2251 commented Feb 11, 2022 via email

@bassoonist
Copy link

bassoonist commented Feb 11, 2022 via email

@mlazowik
Copy link

mlazowik commented Feb 11, 2022

If you want to keep the advantages of http2, like header compression, instead of dropping to http1.1 – http3 gets rid of the head of line blocking issues. On android you can replace okhttp with cronet to get http3 support, you obviously need to support it on your server(s) too.

@songmik
Copy link

songmik commented Dec 30, 2022

okHttpClient = builder.protocols(Arrays.asList(Protocol.HTTP_1_1)).build()

It's Kotlin version.
It worked for me.
Put the 'Protocol.HTTP_1_1' in your okhttp client.

@devonEdison
Copy link

devonEdison commented Jan 16, 2023

okHttpClient = builder.protocols(Arrays.asList(Protocol.HTTP_1_1)).build()

It's Kotlin version. It worked for me. Put the 'Protocol.HTTP_1_1' in your okhttp client.

What okhttp and Nginx version and Android version did you use? @songmik

@psohm
Copy link

psohm commented Mar 6, 2023 via email

@vadiole
Copy link

vadiole commented Mar 6, 2023

Nobody was able to reproduce the problem, I think it is warmly recommended Le dim. 5 mars 2023, 21:04, Dmitriy @.***> a écrit :

I'm sorry, but this particular url seems to be broken. If you open it in the browser there is no end of the json

image

@ernesto13edop
Copy link

My problem was related to CompositeDisposable.

I am using RxJava3 as callAdapter. If you add the call disposable to a CompositeDisposable that is disposed the error occurs. I don't think this is the solution for all of us who have this problem but it might be a good clue to find out what is happening.

@songmik
Copy link

songmik commented Mar 15, 2023

okHttpClient = builder.protocols(Arrays.asList(Protocol.HTTP_1_1)).build()
It's Kotlin version. It worked for me. Put the 'Protocol.HTTP_1_1' in your okhttp client.

What okhttp and Nginx version and Android version did you use? @songmik


Oh I'm sorry, I can't figured out What Nginx version is .. But Okhttp version is 4.9.3.
Anyway I found my problem. The Problem was in my code. I got "Connection", "Close" .
I removed 'close'.
I think 'close' is the default on HTTP/1.0 requests.
So remove the close or change it to keep-alive.


Good luck : )

@yschimke
Copy link
Collaborator

I suspect might be related to #7801, would suggest retesting on OkHttp 5.0.0-alpha12 (not available yet).

@ilgizsa
Copy link

ilgizsa commented Feb 23, 2024

I have same issue
OkHttp 5.0.0-alpha3, RxJava2
I have 100% reproducibility.
We need Charles, we need to put a breakpoint in Charles on the request
When the timeout expires, there will be an error in the logcat, but the request will be repeated endlessly judging by Charles’ session
Therefore, the version of Nginx does not matter
If you remove the breakpoint, the request will be completed, but the result will not be processed in RxJava.
Adding OkHttpClient.Builder.retryOnConnectionFailure(false) helped me, the error remains StreamResetException, but there is no longer an endless retray of requests. And don’t care about StreamResetException since it is instance of IOException

okhttp3.internal.http2.StreamResetException: stream was reset: INTERNAL_ERROR
 at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:148)
 at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.kt:97)
 at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:110)
 at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:93)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at com.finstar.pesoredee.http.curl.CurlInterceptor.intercept(CurlInterceptor.kt:36)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at pesoredee.api.http.AuthInterceptor.intercept(HttpClient.kt:119)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at pesoredee.api.http.HeadersInterceptor.intercept(HeadersInterceptor.kt:38)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:96)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at pesoredee.api.http.HostInterceptor.intercept(HttpClient.kt:96)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:202)
 at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:518)

@ilgizsa
Copy link

ilgizsa commented Feb 23, 2024

Example for reproduce: every 60 seconds request will be repeat if set breakpoint on request in Charles

class MainActivity : AppCompatActivity() {

    private lateinit var apiService: ApiService
    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val okHttpClient = OkHttpClient
            .Builder()
            .cache(Cache(createCacheDir(), 10L * 1024 * 1024))
            .connectTimeout(30L, TimeUnit.SECONDS)
            .readTimeout(60L, TimeUnit.SECONDS)
            .writeTimeout(60L, TimeUnit.SECONDS)
            // Every 60 seconds request will be repeat if set breakpoint on request in Charles
            .addNetworkInterceptor(HeadersInterceptor())
            .addNetworkInterceptor(
                HttpLoggingInterceptor().apply {
                    level = HttpLoggingInterceptor.Level.HEADERS
                }
            )
            .disableCertificateValidation()
            .build()

        val moshi = Moshi.Builder()
            .add(KotlinJsonAdapterFactory())
            .build()

        val retrofit = Retrofit.Builder()
            .baseUrl(ApiService.baseUrl)
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .addConverterFactory(MoshiConverterFactory.create(moshi))
            .client(okHttpClient)
            .build()

        apiService = retrofit.create(ApiService::class.java)

        fetchIssues()
    }

    @SuppressLint("CheckResult")
    private fun fetchIssues() {
        apiService.getIssues(authorization = null)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribeBy(
                onSuccess = {
                    Toast.makeText(this, "Success", Toast.LENGTH_LONG).show()
                    Logger.DEFAULT.log("------Issues successfully loaded------")
                    //Logger.DEFAULT.log("Issues was loaded:\n${it.joinToString(separator = "\n   --- ", prefix = "   --- ")}")
                },
                onError = {
                    Toast.makeText(this, "Error", Toast.LENGTH_LONG).show()
                    it.printStackTrace()
                }
            )
    }

    private fun createCacheDir(): File {
        val cacheDir = File(application.cacheDir, "network-cache")
        if ((!cacheDir.exists() || !cacheDir.isDirectory) && !cacheDir.mkdir()) {
            throw IllegalStateException("Unable to create network cache directory")
        }
        return cacheDir
    }


    class HeadersInterceptor : Interceptor {
        override fun intercept(chain: Interceptor.Chain): Response {
            return chain.proceed(
                chain
                    .request()
                    .newBuilder()
                    .addHeader("Accept", "application/vnd.github json")
                    .addHeader("X-GitHub-Api-Version", "2022-11-28")
                    .build()
            )
        }
    }

    interface ApiService {
        companion object {
            const val baseUrl = "https://api.github.com"
        }

        @GET("repos/octocat/Hello-World/issues")
        fun getIssues(
            @Header("Authorization") authorization: String?,
        ): Single<List<Issue>>
    }

    @JsonClass(generateAdapter = true)
    data class Issue(
        val id: Long,
        val url: String,
        val number: Long,
        val title: String,
    )

    @SuppressLint("CustomX509TrustManager")
    private object TrustAllManager : X509TrustManager {
        override fun getAcceptedIssuers(): Array<X509Certificate> = arrayOf()
        override fun checkClientTrusted(chain: Array<X509Certificate>, authType: String) = Unit
        override fun checkServerTrusted(chain: Array<X509Certificate>, authType: String) = Unit
    }

    fun OkHttpClient.Builder.disableCertificateValidation(): OkHttpClient.Builder =
        arrayOf<X509TrustManager>(TrustAllManager)
            .let { managers ->
                sslSocketFactory(
                    SSLContext
                        .getInstance("SSL")
                        .apply {
                            init(null, managers, java.security.SecureRandom())
                        }
                        .socketFactory,
                    managers.first()
                )
                hostnameVerifier { _, _ -> true }
            }
}

Dependencies


    implementation(platform("com.squareup.okhttp3:okhttp-bom:5.0.0-alpha.3"))
    implementation("com.squareup.okhttp3:okhttp")
    implementation("com.squareup.okhttp3:logging-interceptor")

    implementation("io.reactivex.rxjava2:rxjava:2.2.21")
    implementation("io.reactivex.rxjava2:rxandroid:2.1.1")
    implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")

    implementation("com.squareup.retrofit2:retrofit:2.9.0")
    implementation("com.squareup.retrofit2:adapter-rxjava2:2.9.0")
    implementation("com.squareup.retrofit2:converter-moshi:2.9.0")

    implementation("com.squareup.moshi:moshi-kotlin:1.14.0")
    implementation("com.squareup.moshi:moshi-adapters:1.14.0")
    ksp("com.squareup.moshi:moshi-kotlin-codegen:1.14.0")

@hamidradical
Copy link

Any progress? becuase my some user face this type of error while downloading large json data from stream api. It happens sometime and in some users' device.

i have no idea to reproduce it by my own and in my android device.

@MADDY312
Copy link

MADDY312 commented Jul 8, 2024

any progress on this?

okhttp3.internal.http2.StreamResetException: stream was reset: INTERNAL_ERROR
 at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:148)
 at okhttp3.internal.http2.Http2ExchangeCodec.readResponseHeaders(Http2ExchangeCodec.kt:97)
 at okhttp3.internal.connection.Exchange.readResponseHeaders(Exchange.kt:110)
 at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.kt:93)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at com.finstar.pesoredee.http.curl.CurlInterceptor.intercept(CurlInterceptor.kt:36)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at pesoredee.api.http.AuthInterceptor.intercept(HttpClient.kt:119)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at pesoredee.api.http.HeadersInterceptor.intercept(HeadersInterceptor.kt:38)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:34)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:96)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at pesoredee.api.http.HostInterceptor.intercept(HttpClient.kt:96)
 at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
 at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:202)
 at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:518)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Relates to usage specifically on Android bug Bug in existing code
Projects
None yet
Development

No branches or pull requests