androiddjangookhttphttp2

OkHttp keeps getting StreamResetException: stream was reset: INTERNAL_ERROR when it's 200


I got StreamResetException: stream was reset: INTERNAL_ERROR from OkHttp. What's the problem?

Here's the logs.

I/okhttp.OkHttpClient: <-- 200 https://www.example.com/user/list (396ms)
I/okhttp.OkHttpClient: date: Fri, 04 Dec 2020 02:21:35 GMT
I/okhttp.OkHttpClient: content-type: application/json
I/okhttp.OkHttpClient: content-length: 99730
I/okhttp.OkHttpClient: server: nginx/1.18.0
I/okhttp.OkHttpClient: allow: GET, HEAD, OPTIONS
I/okhttp.OkHttpClient: x-frame-options: DENY
I/okhttp.OkHttpClient: x-content-type-options: nosniff
I/okhttp.OkHttpClient: referrer-policy: same-origin
D/okhttp.Http2: << 0x00000003  5792 DATA          
D/okhttp.Http2: << 0x00000003     4 RST_STREAM    
D/okhttp.TaskRunner: Q10092 canceled              : OkHttp ConnectionPool
D/force: okhttp3.internal.http2.StreamResetException: stream was reset: INTERNAL_ERROR
D/okhttp.Http2: >> 0x00000000     8 GOAWAY     
D/okhttp.TaskRunner: Q10096 finished run in 216 ms: OkHttp www.example.com

This is issued in Okhttp Gihub Repository. But any issues haven't solved yet.

I called the API like this

    @Headers("Content-Type: application/json")
    @GET("/user/list")
    fun getUserList(@Header("Authorization") jwt: String): Call<ArrayList<UserData>>

It's 200 but I get nothing. It's very weird behaviour..

Is it a server problem or my problem? (The server is Django).


Solution

  • it was Nginx buffer size problem.

    If you are using AWS EC2,

    Go to /etc/nginx/default.d/server.conf

    And set,

    proxy_redirect off;
    proxy_buffering off;