apache / apache/dubbo

Dubbo 2.7.11 版本,异步 响应丢失 直到超时。

Open
#9,254 0 comments 0 reactions 0 assignees View on GitHub
type/discussion
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

Dubbo 2.7.11 版本,异步 响应丢失 直到超时。 场景, 某服务 在容器下重新部署,异步调用端 响应丢失 直到超时 (无法恢复,除非调用端服务重启) 。
检查了 DUBBO的代码 Invoker 相关的实现类,DubboInvoker , AbstractInvoker 等 Invoker实现都有异常处理。 Filter实现也有异常处理。
即使 Try住异常, 也有类似 AsyncRpcResult.newDefaultAsyncResult(null, e, invocation); 这样的处理方式。 异常情形下, NettyClientHandler 也有handler.received 这样的处理方式。 找不到具体原因了(如果换成同步调用在上述场景下就是OK的 )。

相关的代码如下:

private
CompletableFuture processSessionRequest(req request, Map.Entry, String> entry) {
try {
SessionService service = (SessionService) findReferenceBean(entry);
service.processSession((SessionRequest) request);
FutureContext context = FutureContext.getContext();
CompletableFuture cF = context.getCompletableFuture();
return processResponse(cF);
} catch (Throwable throwable) {
LOGGER.error("processRequest encounter error.", throwable);
CompletableFuture cF = new CompletableFuture<>();
cF.completeExceptionally(throwable);
return cF;
}
}

private CompletableFuture processResponse(CompletableFuture cF) {
try {
CompletableFuture 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 future = new CompletableFuture<>();
future.completeExceptionally(throwable);
return future;
}
}

不知道 能否给个思路。 谢谢。

Contributor guide

Open the contributing guide

Research direction

Start by tracing the asynchronous path through DubboInvoker, AbstractInvoker, AsyncRpcResult, and NettyClientHandler, then compare it with the synchronous path during a container redeployment. Review the supplied processSessionRequest and processResponse examples and reproduce the lost-response timeout. Done means the cause is identified and the asynchronous call reliably completes with either a response or an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend-api-design, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.