2021-04-29 okhttp SocketTimeoutException异常排查

更换使用了okhttp3,发现有许多SocketTimeoutException

网上一大堆设置超时时间的文章,但并不适用我的问题

我的

CONNECT_TIMEOUT
READ_TIMEOUT

都是10s,环境是内网,交互数据量也不大,请求稍频繁,便有超时问题。

使用的是okhttp同步请求,游戏服玩家A在请求跨服进行赠礼给B的操作时,跨服会同时通知游戏服玩家B数据变化,去掉通知玩家B便不会有超时问题。

怀疑可能是线程阻塞的原因,遂将跨服通知游戏服玩家B改为从线程池中另取线程发起请求,超时问题ok。

java接入智谱清言Exception in thread "main" java.lang.RuntimeException: java.net.SocketTimeoutException: timeout at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:45) at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:90) at io.reactivex.Single.blockingGet(Single.java:2002) at com.zhipu.oapi.AbstractClientBaseService.execute(ClientV4.java:82) at com.zhipu.oapi.ClientV4.executeRequest(ClientV4.java:505) at com.zhipu.oapi.ClientV4.invoke(ClientV4.java:176) at com.zhipu.oapi.ClientV4.invokeModelApi(ClientV4.java:151) at com.jason.health.controller.AITest.Test1(AITest.java:70) at com.jason.health.controller.AITest.main(AITest.java:24) Caused by: java.net.SocketTimeoutException: timeout at okhttp3.internal.http2.Http2Stream$StreamTimeout.newTimeoutException(Http2Stream.kt:675) at okhttp3.internal.http2.Http2Stream$StreamTimeout.exitAndThrowIfTimedOut(Http2Stream.kt:684) at okhttp3.internal.http2.Http2Stream.takeHeaders(Http2Stream.kt:143) 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 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.RealInterce
最新发布
03-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值