fl061157 opened a new issue #9254:
URL: https://github.com/apache/dubbo/issues/9254


   Dubbo 2.7.11 版本,异步 响应丢失 直到超时。 场景, 某服务 在容器下重新部署,异步调用端  响应丢失 直到超时 
(无法恢复,除非调用端服务重启) 。 
   检查了 DUBBO的代码 Invoker 相关的实现类,DubboInvoker , AbstractInvoker  等 Invoker 
等都有异常处理。 Filter也有异常处理。
   即使 Try住异常, 也有类似 =AsyncRpcResult.newDefaultAsyncResult(null, e, invocation); 
这样的处理方式。 异常情形下, NettyClientHandler 也有handler.received 这样的处理方式。 
找不到具体原因了(如果换成同步调用就是OK的 )。
   
   相关的调用代码如下:
   
   `    private <req extends BaseRequest, resp extends BaseResponse>
       CompletableFuture<resp> processSessionRequest(req request, 
Map.Entry<Class<?>, String> entry) {
           try {
               SessionService service = (SessionService) 
findReferenceBean(entry);
               service.processSession((SessionRequest) request);
               FutureContext context = FutureContext.getContext();
               CompletableFuture<Object> cF = context.getCompletableFuture();
               return processResponse(cF);
           } catch (Throwable throwable) {
               LOGGER.error("processRequest encounter error.", throwable);
               CompletableFuture<resp> cF = new CompletableFuture<>();
               cF.completeExceptionally(throwable);
               return cF;
           }
       }`
   ` private <resp extends BaseResponse> CompletableFuture<resp> 
processResponse(CompletableFuture<Object> cF) {
           try {
               CompletableFuture<resp> completable = new CompletableFuture<>();
               if (Objects.isNull(cF)) {
                   LOGGER.error("empty completableFuture.");
                   completable.completeExceptionally(new 
NullPointerException("empty completableFuture."));
                   return completable;
               }
               cF.whenCompleteAsync((response, throwable) -> {
                   if (Objects.nonNull(throwable)) {
                       LOGGER.error("processSessionRequest encounter error.", 
throwable);
                       completable.completeExceptionally(throwable);
                       return;
                   }
                   try {
                       Object value = response;
                       if (Objects.nonNull(value)) {
                           completable.complete((resp) value);
                       } else {
                           completable.completeExceptionally(new 
NullPointerException("result is empty."));
                       }
                   } catch (Throwable throwable1) {
                       LOGGER.error("Invoke rpc parse result error.", 
throwable1);
                       completable.completeExceptionally(throwable1);
                   }
               });
               return completable;
           } catch (Throwable throwable) {
               LOGGER.error("processResponse encounter error.", throwable);
               CompletableFuture<resp> future = new CompletableFuture<>();
               future.completeExceptionally(throwable);
               return future;
           }
       }`
   
   不知道 能否给个思路。 谢谢。
   
   
   
   
   
   
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to