OkHttp不断获取StreamResetException:流已重置:INTERNAL_ERROR为200时 [英] OkHttp keeps getting StreamResetException: stream was reset: INTERNAL_ERROR when it's 200

查看:171
本文介绍了OkHttp不断获取StreamResetException:流已重置:INTERNAL_ERROR为200时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到了 StreamResetException:流从OkHttp被重置:INTERNAL_ERROR .有什么问题吗?

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

这是日志.

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

这是在Okhttp Gihub存储库中发布的.但是任何问题都还​​没有解决.

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

我这样调用API

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

现在是200,但我什么也没得到.这是非常奇怪的行为.

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

是服务器问题还是我的问题?(服务器是Django).

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

推荐答案

如OkHttp问题跟踪器中所建议,最有可能是发送标头后出现服务器错误.

As suggested in OkHttp issue tracker, mostly likely this is a server error after the headers are sent.

https://github.com/square/okhttp/issues/3936

通常,服务器发送错误代码以指示服务器端有问题.如果OkHttp的流读取器由于意外的异常而崩溃,也可能发生这种情况.

Typically error code is sent by a server to indicate a problem server-side. It could also happen if OkHttp’s stream reader crashes with an unexpected exception.

如果可以的话,我建议您检查服务器错误,但是您可以在此处从服务器上看到Http2框架

I'd suggest checking for server errors if you can, but you can see the Http2 frame from the server here

D/okhttp.Http2: << 0x00000003     4 RST_STREAM  

这篇关于OkHttp不断获取StreamResetException:流已重置:INTERNAL_ERROR为200时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆