client elapsed: 0 ms, server elapsed: 1022 ms, timeout: 1000 ms,
{timestamp: 1528113688276, status: 500, error: "Internal Server Error",…}
error
:
"Internal Server Error"
exception
:
"com.alibaba.dubbo.rpc.***”
message
:
"Failed to invoke the method getById in the service com.shuwen.production.media.manage.client.media.MediaServiceFacade. Tried 3 times of the providers [172.20.3.5:20880, 172.20.3.15:20880, 172.20.3.11:20880] (3/3) from the registry 0.0.0.0:9090 on the consumer 172.20.30.48 using the dubbo version 2.8.6. Last error is: Invoke remote method timeout. method: getById, provider: dubbo://172.20.3.15:20880/
cause: Waiting server-side response timeout by scan timer. start time: 2018-06-04 20:01:27.251, end time: 2018-06-04 20:01:28.273, client elapsed: 0 ms, server elapsed: 1022 ms, timeout: 1000 ms, request: Request [id=178349, version=2.0.0, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=getById, parameterTypes=[class com.shuwen.production.media.manage.dto.media.MediaDTO], arguments=[MediaDTO{mediaId='c82e54c8-f6cc-407a-8b35-bc09f6b947f6', userId=null, enterpriseId=null, mediaType='image', openType='null', title='null', url='null', categoryId='null', folderId='null', parentMediaId='null', thumbImage='null', fileSize=null, occurTimestamp=null, publishStatus='null', source='null', content='null', outId='null', outKeyword='null', dupMediaId='null', quality=null, subMediaType='null', wordCount=null, shot='null', scene='null', sizeScope='null', duration=null, bitrate=null, durationScope='null', definitionScope='null', subMediaCount=0, entityList=null, tagList=null, extra='null'} BaseDTO{gmtCreate=null, gmtModified=null, criteria=null}], attachments={path=com.shuwen.production.media.manage.client.media.MediaServiceFacade, interface=com.shuwen.production.media.manage.client.media.MediaServiceFacade, version=1.0}]], channel: /172.20.30.48:33914 -> /172.20.3.15:20880"
path
:
"/api/***/***”
status
:
500
timestamp
:
1528113688276
解析与解决方法:
Dubbo是阿里开源的分布式远程调用方案(RPC),由于网络或服务端不可靠,会导致调用出现一种不确定的中间状态(超时)。为了避免超时导致客户端资源(线程)挂起耗尽,必须设置超时时间。Provider可以配置的Consumer端主要属性有timeout、retries、loadbalance、actives和cluster。Provider上应尽量多配置些Consumer端的属性,让Provider实现者一开始就思考Provider的服务特点与服务质量。配置之间存在着覆盖,具体规则如下:
1. 方法级配置别优于接口级别,即小Scope优先
2. Consumer端配置优于Provider配置,优于全局配置
3. Dubbo Hard Code的配置值(默认)根据规则2,纵使消费端配置优于服务端配置,但消费端配置超时时间不能随心所欲,需要根据业务实际情况来设定。如果超时时间设置得太短,复杂业务本来就需要很长时间完成,服务端无法在设定的超时时间内完成业务处理;如果超时时间设置太长,会由于服务端或者网络问题导致客户端资源大量线程挂起。
超时配置:
Dubbo消费端
1---全局超时配置:<dubbo:consumer timeout="5000" /> 调高一点
2--指定接口以及特定方法超时配置
<dubbo:reference interface="com.asia.service" timeout="2000"> <dubbo:method name="getOne" timeout="3000" /></dubbo:reference>
Dubbo服务端
1--全局超时配置 :<dubbo:provider timeout="5000" />
2- 指定接口以及特定方法 超时配置
<dubbo:provider interface="com.asis.service" timeout="2000"><dubbo:method name="getOne" timeout="3000" />
</dubbo:provider>
3
Dubbo协议超时实现
Dubbo协议超时实现使用了Future模式,主要涉及类DubboInvoker,ResponseFuture, DefaultFuture。
ResponseFuture.get()在请求还未处理完或未到超时前一直是wait状态;响应达到后,设置请求状态,并进行notify唤醒。
public Object get() throws RemotingException {return get(timeout);}public Object get(int timeout) throws RemotingException {if (timeout <= 0) {timeout = Constants.DEFAULT_TIMEOUT;}if (! isDone()) {long start = System.currentTimeMillis();lock.lock();try {while (! isDone()) {done.await(timeout, TimeUnit.MILLISECONDS);if (isDone() || System.currentTimeMillis() - start > timeout) {break;}}} catch (InterruptedException e) {throw new RuntimeException(e);} finally {lock.unlock();}if (! isDone()) {throw new TimeoutException(sent > 0, channel, getTimeoutMessage(false));}}return returnFromResponse();}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
public static void received(Channel channel, Response response) {try {DefaultFuture future = FUTURES.remove(response.getId());if (future != null) {future.doReceived(response);} else {logger.warn("The timeout response finally returned at " + (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").format(new Date())) + ", response " + response + (channel == null ? "" : ", channel: " + channel.getLocalAddress() + " -> " + channel.getRemoteAddress()));}} finally {CHANNELS.remove(response.getId());}}private void doReceived(Response res) {lock.lock();try {response = res;if (done != null) {done.signal();}} finally {lock.unlock();}if (callback != null) {invokeCallback(callback);}}
client elapsed: 0 ms, server elapsed: 1022 ms, timeout: 1000 ms,相关推荐
- [28000][Microsoft][SQL server native client 10.0][SQL server]用户‘sa’登录失败。(18456)
用native远程连接SQL server数据库提示:[28000][Microsoft][SQL server native client 10.0][SQL server]用户'sa'登录失败.( ...
- 因为数据库正在使用,所以无法获得对数据库的独占访问权。 (3101)[42000] [Microsoft][SQL Server Native Client 10.0][SQL Server]RES
问题描述: SQL server 数据库还原时,遇到问题. [RES] Database restore start [RES] (Full) [2022-06-27 22:12:15.000] [ ...
- MS SQL Server数据库修复利器—D-Recovery For MS SQL Server数据恢复软件
微软的SQL Server 数据库最常用的有两种类型的文件: 1.主要数据文件,文件后缀一般是.MDF: 2.事务日志文件,文件后缀一般是.LDF. 用户数据表.视图.存储过程等等数据,都是存放在MD ...
- 在Windows Server 2003上运行vSphere Client 4.0出现“clients.xml文件出错r
在Windows Server 2003上运行vSphere Client 4.0出现"clients.xml文件出错"的解决方法 当vSphere Client 4.0在Wind ...
- windows解决error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
windows解决error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27 环境 报错 解决方 ...
- INFO ipc.Client:Retrying connect to server 9000
hadoop使用bin/start_all.sh命令之后,使用jps发现datanode无法启动 This problem comes when Datanode daemon on the syst ...
- Eureka Client注册到Eureka Server的秘密
前言 我们知道Eureka分为两部分,Eureka Server和Eureka Client.Eureka Server充当注册中心的角色,Eureka Client相对于Eureka Server来 ...
- supersocket缓冲区_使用Socket从Client传输文件到Server对文件缓冲区大小有限制么?...
Client端代码: public class Client implements Runnable { private String ip;// 连接IP private int port;// 连 ...
- C语言实验——逆置正整数 Time Limit: 1000 ms Memory Limit: 65536 KiB 1189
C语言实验--逆置正整数 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 输入一个三位正整数,将它反向输出. Input ...
最新文章
- 异步IO一定更好吗?
- TensorFlow人工智能引擎入门教程之十 最强网络 RSNN深度残差网络 平均准确率96-99%
- JS-String方法
- kvm 虚拟机 实用工具笔记(方便查看ip 磁盘复制和修改文件等)
- 鸿蒙手机系统开发大会,鸿蒙OS+EMUI10,华为开发者大会的创新与看点
- 【渝粤教育】 国家开放大学2020年春季 2772家畜环境卫生与设施 参考试题
- 20172332 2017-2018-2 《程序设计与数据结构》第七周学习总结
- 点击button标签会导致提交form
- [译]GotW #1: Variable Initialization 续
- Ubuntu 16.04 使用 Libcoap
- 这壁纸,领导看了不开心
- Bagging与Boosting的区别与联系
- Windows Server 2003 R2标准版 SP2 64位 (简体中文)官方原版ISO镜像
- 超级外链工具:一款超级外链SEO工具源码
- html 图层嵌套特点,ps图层有哪几种类型?
- 手机软件测试规范(含具体用例)
- 《痞子衡嵌入式半月刊》 第 51 期
- 芯片无忧 V1.5(ChipEasy)U盘固态硬盘检测工具 量产必备
- excel 两组数据交点_如何在百万级的数据里找到别人正在赚钱的项目?【实操长文】...
- visual studio 2010 怎么显示行号