buguge - Keep it simple,stupid

知识就是力量,但更重要的,是运用知识的能力why buguge?

导航

[WIP]dubbo常见异常及原因分析

说来真巧,2018年下半年时使用Thrift作为局域网服务rpc通信框架,整理了一下Thrift常见问题,博客访问量较高,也有同学私信讨论Thrift遇到的问题。此后的工作中,用dubbo比较多,好脑袋不如烂笔头,经常排查dubbo问题,还是整理一下分享出来。

【词汇】

payload-负载,最大负荷,有效负荷;

■ com.alibaba.dubbo.rpc.RpcException: No provider available for service

异常描述1(dubbo2.5.3):

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method *** in the service com..**Service. No provider available for the service test/com..***Service from registry 192.168.40.21:2181 on the consumer 192.168.40.51 using the dubbo version 2.5.3. Please check if the providers have been started and registered.

异常描述2(dubbo2.7.3):

org.apache.dubbo.rpc.RpcException: No provider available from registry 192.168.40.84:2181 for service dev/com..**Service on consumer 192.168.48.96 use dubbo version 2.7.3, please check status of providers(disabled, not registered or in blacklist).

 异常堆栈:

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method getAgent in the service com.emaxcard.agent.modules.agent.service.AgentService. 
No provider available for the service test/com.emaxcard.agent.modules.agent.service.AgentService from registry 192.168.40.21:2181
on the consumer 192.168.40.51 using the dubbo version 2.5.3. Please check if the providers have been started and registered. at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.checkInvokers(AbstractClusterInvoker.java:246) at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:55) at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:227) at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72) at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52) at com.alibaba.dubbo.common.bytecode.proxy1.getAgent(proxy1.java) at com.yft.service.impl.TAgentServiceImpl.getAgentInfo(TAgentServiceImpl.java:86)

 产生原因:

No provider available--很明显,就是说指定的服务在注册中心不存在。

Please check if the providers have been started and registered.-请确保服务提供者已经启动,并且已经注册到注册中心。

1. dubbo服务没有启动

2. dubbo服务不可用 / 在dubboadmin上做了disable操作

 

 3. 如果使用了dubbo分组(group),可能是指定为这个group的dubbo服务没有启动

 

■ org.apache.dubbo.rpc.RpcException: Failed to invoke remote proxy method

下面case里异常的cause很明显,rpc接口服务中不存在指定的接口方法。

org.apache.dubbo.rpc.RpcException: Failed to invoke remote proxy method getById to registry://*.*.2.8:2181/org.apache.dubbo.registry.RegistryService?application=task-provider&backup=*.*.2.9:2181,*.*.2.10:2181,*.*.0.103:2181,*.*.0.104:2181&dubbo=2.0.2&export=见下方dubbourl&pid=1&qos.enable=false&registry=zookeeper&release=2.7.3&timestamp=1694520804438, cause: Not found method "getById" in class com.emaxcard.boss.modules.task.service.TaskService.

上面registry url中export参数值是一个dubbo url,解码后是→ dubbo://10.244.1.223:20789/com.emaxcard.boss.modules.task.service.TaskService?anyhost=true&application=task-provider&bean.name=ServiceBean:com.emaxcard.boss.modules.task.service.TaskService&bind.ip=10.244.1.223&bind.port=20789&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=prod&interface=com.emaxcard.boss.modules.task.service.TaskService&methods=updateBatch,getTaskforTaskStatus,getSimpleVOById,saveTaskInfo,removeById,saveSaleTask,save,getTotalCount,saveEtlTask,listWaitNotifyTask,pubTask,getByIds,page2,removeByIds,audit,getTaskAndProjectByTaskId,updateTaskInfoSelective,releaseTask,getCountInfo,closeTask,getSimpleVOByTaskId,batchCloseByTaskIdAndProviderId,queryByEnterpriseId,edit,saveBatch,getTaskByTaskId,updateFailedTask,getTaskByEntId,importServicePo,list,getByTaskId,updateTaskAndRequireById,updateById,updateTaskAndProject,sumTotalCount,endTask,updateLevyTaskStatus,page,taskToChannel,exportTaskList&pid=1&qos.enable=false&register=true&release=2.7.3&side=provider&timeout=15000&timestamp=1694520804438

■ org.apache.dubbo.remoting.RemotingException:Server side threadpool is exhausted

异常信息(IP地址中的.改为了_):

2023-09-18 10:37:11.638 [TID:464335dde660458fb1e1e1f48477a901.350.16950046314814569] [7e6905cb709d47b4805b0d589492834b] [SimpleAsyncTaskExecutor-10250] ERROR o.s.a.i.SimpleAsyncUncaughtExceptionHandler:39 -
Unexpected exception occurred invoking async method: public void com.emax.user.sign.service.UserSignCallbackProxy.updateYoufuSignStatus(UserSign,TaxSignStatusEnum,String,Boolean)
org.apache.dubbo.rpc.RpcException: Failed to invoke the method updateBossKgSignStatus in the service com.emaxcard.boss.modules.user.service.UserSignCallbackService.
Tried 1 times of the providers [10_244_9_50:20880] (1/7) from the registry 10_0_2_8:2181 on the consumer 10_244_9_44 using the dubbo version 2.7.3.
Last error is: Failed to invoke remote method: updateBossKgSignStatus,
provider: dubbo://10_244_9_50:20880/com.emaxcard.boss.modules.user.service.UserSignCallbackService?anyhost=true&application=zhenghe-provider&bean.name=ServiceBean:com.emaxcard.boss.modules.user.service.UserSignCallbackService&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=prod&interface=com.emaxcard.boss.modules.user.service.UserSignCallbackService&lazy=false&methods=updateBossKgSignStatus&pid=1&qos.enable=false&reference.filter=tracing&register=true&register.ip=10_244_9_44&release=2.7.3&remote.application=bosskg-server-provider&retries=0&revision=1.0.1-SNAPSHOT&side=consumer&sticky=false&timeout=30000&timestamp=1694954526841,
cause: org.apache.dubbo.remoting.RemotingException:Server side(10_244_9_50,20880) threadpool is exhausted ,detail msg:Thread pool is EXHAUSTED! Thread Name: DubboServerHandler-10_244_9_50:20880, Pool Size: 200 (active: 200, core: 200, max: 200, largest: 200), Task: 20776 (completed: 20576), Executor status:(isShutdown:false, isTerminated:false, isTerminating:false), in dubbo://10_244_9_50:20880!
at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInv

产生原因:

"threadpool is exhausted"异常是由于 Dubbo 框架中的线程池资源耗尽所引起的。Dubbo 是一种高性能的分布式服务框架,而线程池是 Dubbo 用于处理请求和响应的关键组件之一。

当系统的并发请求超过了线程池的最大容量时,就会发生线程池资源耗尽的情况,从而导致"threadpool is exhausted"异常。这表示当前线程池无法再接受更多的任务,无法处理新的请求。

要解决"Dubbo threadpool is exhausted"异常,可以考虑以下几个方面:

1. 调整线程池配置:检查当前线程池的配置参数,例如核心线程数、最大线程数、队列容量等。根据系统负载和预期的并发量,适当调整这些参数,增加线程池的容量,以满足更多的请求。

2. 增加机器资源:如果线程池已经配置到最大容量,仍然无法满足需求,可以考虑增加机器的资源,例如增加服务器数量或者升级服务器的配置,以提供更多的计算资源。

3. 优化服务性能:分析服务的性能瓶颈,找到导致高负载的原因,并进行优化。可能需要优化代码、数据库访问、网络通信等方面,以减少每个请求的处理时间,从而减少线程池的压力。

4. 使用合适的线程池类型:Dubbo 提供了多种线程池类型,例如固定大小线程池、可缓存线程池、可伸缩线程池等。根据应用场景和需求,选择合适的线程池类型,以满足不同的并发需求。

5. 监控和调优:使用监控工具对线程池的使用情况进行监控,及时发现线程池资源不足的问题,并进行调优。可以根据监控数据进行容量规划和性能优化。

■ com.alibaba.dubbo.remoting.RemotingException: message can not send, because channel is closed

异常描述:

com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method *** in the service com..***Service. Tried 1 times of the providers [192.168.40.83:20899] (1/1) from the registry 192.168.40.21:2181 on the consumer 192.168.40.51 using the dubbo version 2.5.3.----Caused by: com.alibaba.dubbo.remoting.RemotingException: message can not send, because channel is closed . 

异常堆栈:

2021-11-04 13:55:36.596 [ERROR] [riskOder_synchronizePlatOrder_1636005060003S457] [com.yft.service.impl.TAgentServiceImpl:89] *****获得渠道商信息,dubbo调用异常:
com.alibaba.dubbo.rpc.RpcException: Failed to invoke the method getAgent in the service com.emaxcard.agent.modules.agent.service.AgentService. 
Tried
1 times of the providers [192.168.40.83:20899] (1/1) from the registry 192.168.40.21:2181 on the consumer 192.168.40.51 using the dubbo version 2.5.3.
Last error is: Failed to invoke remote method: getAgent,
provider: dubbo://192.168.40.83:20899/com.emaxcard.agent.modules.agent.service.AgentService?anyhost=true&application=youfu-merchant-consumer&bean.name=ServiceBean:com.emaxcard.agent.modules.agent.service.AgentService&check=false&default.check=false&default.group=test&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=test&interface=com.emaxcard.agent.modules.agent.service.AgentService&methods=saveAgent,selectSecondAndThirdAgent,getAgentByAgentCode,changeLoginPass,selectFirstAgent,listAgentByAgentName,initPassword,updateAgent,page,agentList,getAgentByName&pid=17492&register=true&release=2.7.3&retries=0&revision=1.0.1-SNAPSHOT&side=consumer&timeout=3000&timestamp=1635997957739,
cause: message can not send, because channel is closed .
url:dubbo:
//192.168.40.83:20899/com.emaxcard.agent.modules.agent.service.AgentService?anyhost=true&application=youfu-merchant-consumer&bean.name=ServiceBean:com.emaxcard.agent.modules.agent.service.AgentService&check=false&codec=dubbo&default.check=false&default.group=test&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=test&heartbeat=60000&interface=com.emaxcard.agent.modules.agent.service.AgentService&methods=saveAgent,selectSecondAndThirdAgent,getAgentByAgentCode,changeLoginPass,selectFirstAgent,listAgentByAgentName,initPassword,updateAgent,page,agentList,getAgentByName&pid=17492&register=true&release=2.7.3&retries=0&revision=1.0.1-SNAPSHOT&side=consumer&timeout=3000&timestamp=1635997957739 at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:101) at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:227) at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72) at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:52) at com.alibaba.dubbo.common.bytecode.proxy1.getAgent(proxy1.java) at com.yft.service.impl.TAgentServiceImpl.getAgentInfo(TAgentServiceImpl.java:86) at ... Caused by: com.alibaba.dubbo.remoting.RemotingException: message can not send, because channel is closed .
url:dubbo:
//192.168.40.83:20899/com.emaxcard.agent.modules.agent.service.AgentService?anyhost=true&application=youfu-merchant-consumer&bean.name=ServiceBean:com.emaxcard.agent.modules.agent.service.AgentService&check=false&codec=dubbo&default.check=false&default.group=test&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=test&heartbeat=60000&interface=com.emaxcard.agent.modules.agent.service.AgentService&methods=updateStateAgent,saveAgent,selectSecondAndThirdAgent,getAgentByAgentCode,changeLoginPass,listAgentByName,getAgent,selectFirstAgent,listAgentByAgentName,initPassword,belongingSubordinate,reset,updateAgent,getHomeInfo,page,agentList,getAgentByName&pid=17492&register=true&release=2.7.3&retries=0&revision=1.0.1-SNAPSHOT&side=consumer&timeout=3000&timestamp=1635997957739 at com.alibaba.dubbo.remoting.transport.AbstractClient.send(AbstractClient.java:268) at com.alibaba.dubbo.remoting.transport.AbstractPeer.send(AbstractPeer.java:51) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.request(HeaderExchangeChannel.java:112) at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeClient.request(HeaderExchangeClient.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.ReferenceCountExchangeClient.request(ReferenceCountExchangeClient.java:81) at com.alibaba.dubbo.rpc.protocol.dubbo.DubboInvoker.doInvoke(DubboInvoker.java:96) at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:144) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke$original$YXlgcHUl(MonitorFilter.java:75) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke$original$YXlgcHUl$accessor$WxlrIuUu(MonitorFilter.java) at com.alibaba.dubbo.monitor.support.MonitorFilter$auxiliary$LX9nuPMk.call(Unknown Source) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:86) at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:48) at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:91) at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:74) at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:53) at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77) ... 69 more

 

产生原因:

dubbo服务没有启动/dubbo服务挂掉了。此时,consumer会尝试重新建立连接重新调用。重试次数取决于为属性dubbo.consumer.retries配置的值。retries的默认值为2,对于增删改操作,服务端要注意做幂等控制,避免出现重复处理的情况。当然,为了避免重复调用,有时我们会设置dubbo.consumer.retries=0,上面异常里Tried 1 times就是未重试。

■ org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer

 异常描述:

Failed to invoke the method *** in the service com..***Service. Tried 1 times of the providers [192.168.40.48:20881] (1/1) from the registry 192.168.40.20:2181 on the consumer 192.168.40.85 using the dubbo version 2.7.3. Last error is: Invoke remote method timeout.  cause: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout. start time: 2021-09-26 10:09:04.842, end time: 2021-09-26 10:09:34.871, client elapsed: 1 ms, server elapsed: 30028 ms, timeout: 30000 ms.

异常堆栈:

2021-09-26 10:09:27.888 [][] [DubboServerHandler-192.168.40.85:20888-thread-199] INFO  com.emax.zhenghe.common.tracking.DubboTraceFilter:62 - found slow method:com.emax.zhenghe.portalapi.modules.enterprise.service.EnterpriseInfoApi:onlineAuthEnterpriseStatus,exec time:30030 ms
2021-09-26 10:09:34.873 [][] [EnterpriseInfoApiImpl_onlineAuthEnterpriseStatus1632622144838] ERROR c.e.z.rpcapi.provider.portal.EnterpriseInfoApiImpl:95 - 在线企业认证状态获取失败
org.apache.dubbo.rpc.RpcException: Failed to invoke the method queryOrganizationStatus in the service com.auth.api.service.ContractSignOrganizationService. 
Tried 1 times of the providers [192.168.40.48:20881] (1/1) from the registry 192.168.40.20:2181 on the consumer 192.168.40.85 using the dubbo version 2.7.3.
Last error is: Invoke remote method timeout. method: queryOrganizationStatus,
provider: dubbo://192.168.40.48:20881/com.auth.api.service.ContractSignOrganizationService?anyhost=true&application=zhenghe-provider&bean.name=ServiceBean:com.auth.api.service.ContractSignOrganizationService&check=false&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&group=test&interface=com.auth.api.service.ContractSignOrganizationService&lazy=false&methods=organizationStatusUpdate,getListByParam,getContractSignInfo,queryOrganizationStatus,organizationCreate,update,insert,list,updateOrganizationCreateStatus&pid=29399&qos.enable=false&register=true&register.ip=192.168.40.85&release=2.7.3&remote.application=auth-service-channel&retries=0&side=consumer&sticky=false&timeout=30000&timestamp=1632622128250,
cause: org.apache.dubbo.remoting.TimeoutException: Waiting server-side response timeout by scan timer. start time: 2021-09-26 10:09:04.842, end time: 2021-09-26 10:09:34.871, client elapsed: 0 ms, server elapsed: 30028 ms, timeout: 30000 ms, request: Request [id=71603, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=queryOrganizationStatus, parameterTypes=[class java.lang.String], arguments=[1626769691952966], attachments={input=696, path=com.auth.api.service.ContractSignOrganizationService, sw8-x=0- , sw8=1-M2EyNWZlODhlZGUzNDAwNjlhYmFiMmYzZWJhZWMyYjkuNzkuMTYzMjYyMjE0NDgxNzAyMjc=-NTVmOTViYWI1M2UwNGI4ZWE1ZTMxZTA5NmY4ZDM1MDEuMzgwLjE2MzI2MjIxNDQ4Mzg1MDc4-6-emhlbmdoZS1ycGNhcGktcHJvdmlkZXI=-emhlbmdoZS1ycGNhcGktcHJvdmlkZXJAYm9nb24=-dGVzdC9jb20uZW1heC56aGVuZ2hlLnBvcnRhbGFwaS5tb2R1bGVzLmVudGVycHJpc2Uuc2VydmljZS5FbnRlcnByaXNlSW5mb0FwaS5vbmxpbmVBdXRoRW50ZXJwcmlzZVN0YXR1cyhMb25nKQ==-MTkyLjE2OC40MC40ODoyMDg4MQ==, sw8-correlation=, interface=com.auth.api.service.ContractSignOrganizationService, version=0.0.0, timeout=30000, group=test}]], channel: /192.168.40.85:55882 -> /192.168.40.48:20881 at org.apache.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:113) at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:248) at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:78) at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:55) at org.apache.dubbo.common.bytecode.proxy10.queryOrganizationStatus(proxy10.java) at ... Caused by: java.util.concurrent.ExecutionException: org.apache.dubbo.remoting.TimeoutException:
Waiting server-side response timeout by scan timer. start time: 2021-09-26 10:09:04.842, end time: 2021-09-26 10:09:34.871, client elapsed: 0 ms, server elapsed: 30028 ms, timeout: 30000 ms,
request: Request [id=71603, version=2.0.2, twoway=true, event=false, broken=false, data=RpcInvocation [methodName=queryOrganizationStatus, parameterTypes=[class java.lang.String], arguments=[1626769691952966], attachments={input=696, path=com.auth.api.service.ContractSignOrganizationService, sw8-x=0- , sw8=1-M2EyNWZlODhlZGUzNDAwNjlhYmFiMmYzZWJhZWMyYjkuNzkuMTYzMjYyMjE0NDgxNzAyMjc=-NTVmOTViYWI1M2UwNGI4ZWE1ZTMxZTA5NmY4ZDM1MDEuMzgwLjE2MzI2MjIxNDQ4Mzg1MDc4-6-emhlbmdoZS1ycGNhcGktcHJvdmlkZXI=-emhlbmdoZS1ycGNhcGktcHJvdmlkZXJAYm9nb24=-dGVzdC9jb20uZW1heC56aGVuZ2hlLnBvcnRhbGFwaS5tb2R1bGVzLmVudGVycHJpc2Uuc2VydmljZS5FbnRlcnByaXNlSW5mb0FwaS5vbmxpbmVBdXRoRW50ZXJwcmlzZVN0YXR1cyhMb25nKQ==-MTkyLjE2OC40MC40ODoyMDg4MQ==, sw8-correlation=, interface=com.auth.api.service.ContractSignOrganizationService, version=0.0.0, timeout=30000, group=test}]],
channel: /192.168.40.85:55882 -> /192.168.40.48:20881 at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1915) at org.apache.dubbo.rpc.protocol.AsyncToSyncInvoker.invoke(AsyncToSyncInvoker.java:56) at com.emax.zhenghe.common.tracking.DubboTraceFilter.invoke(DubboTraceFilter.java:32) at ... 78 common frames omitted

产生原因:

dubbo调用超时。服务端处理超时。dubbo超时时间通过dubbo.provider.timeout或dubbo.consumer.timeout来设置。dubbo默认超时时间是1000ms=1秒。客户端dubbo调用超时后会尝试重试,重试次数取决于上文的retries属性。see dubbo超时重试

在生产环境,要控制dubbo超时时间,尤其是consumer端。timeout过长容易引起雪崩。

 

■ com.alibaba.dubbo.rpc.RpcException: Forbid consumer *** access service *** from registry *** use dubbo version 2.5.3, Please check registry access list (whitelist/blacklist).

异常描述:

com.alibaba.dubbo.rpc.RpcException: Forbid consumer *.*.2.224 access service com.emax.zhenghe.portalapi.modules.sms.service.EmaxSettlementSmsRecordService from registry *.*.2.8:2181 use dubbo version 2.5.3, Please check registry access list (whitelist/blacklist).

异常堆栈:

2021-09-16 22:24:03.290 [ERROR] [a54f25179c9a4062abe4457cebb65a34] [paymentQuery_timer_1631802240392CA90D] [com.cn.yft.bank.p600001.own.PaymentTransQueryByOWN:298] 获取下发成功人员信息失败,发送通知短信异常:
com.alibaba.dubbo.rpc.RpcException: Forbid consumer *.*.2.224 access service com.emax.zhenghe.portalapi.modules.sms.service.EmaxSettlementSmsRecordService from registry *.*.2.8:2181 use dubbo version 2.5.3, Please check registry access list (whitelist/blacklist).
        at com.alibaba.dubbo.registry.integration.RegistryDirectory.doList(RegistryDirectory.java:579)
        at com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.list(AbstractDirectory.java:73)
        at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.list(AbstractClusterInvoker.java:260)
        at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:219)
        at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:72)

 

产生原因:

当某个服务的provider有变化时就会被调用,例如zookeeper上某个服务的provider目录里的内容发生变化,则zk监听器会被触发,由于provider的数量会发生变化,例如有一个新的provider启动了,有一个provider下线了,所以必须刷新本地的对provider的连接。这时会涉及到服务提供者与消费者的分组(group)、版本(version)、接口名,如果不一致,就会报这个“forbid consumer access service”的错误。可参见csdn这篇帖子

■ org.apache.dubbo.remoting.transport.ExceedPayloadLimitException:Data length too large: ***, max payload: 8,388,608, channel: ...

异常描述:

dubbo并不适合大数据传输。当调用dubbo接口传输数据比较大时,比如图片字节流,文件字节流,一旦超过设定的阈值(dubbo默认值是8M=8*1024*1024),就会抛出这个ExceedPayloadLimitException异常--超出最大负荷。

 

源码参见org.apache.dubbo.remoting.transport.AbstractCodec#checkPayload

 

基于此,改造方案可以是:① 如果是图片等文件,可考虑传递文件路径; ② 如果传输数据量比较大,比如返回了上万条数据记录,并且单条数据量比较大,建议用分页多次调用; ③ 改用http请求

 

posted on 2021-11-04 14:20  buguge  阅读(4654)  评论(0编辑  收藏  举报