-
Notifications
You must be signed in to change notification settings - Fork 26.5k
invoke onError when timeout occurred in async mode #5827
Copy link
Copy link
Closed
Description
- I have searched the issues of this repository and believe that this is not a duplicate.
- I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.7.3
- Operating System version: MacOs
- Java version: 1.8
Steps to reproduce this issue
1.start DemoService provider
2.Set onreturn and onthrow for sayHello method in async mode, and then start consumer.
<bean id="demoCallback" class="com.alibaba.dubbo.samples.notify.impl.NotifyImpl" />
<dubbo:reference id="demoService" interface="com.alibaba.dubbo.DemoService">
<dubbo:method name="sayHello" onreturn="demoCallback.onreturn" onthrow="demoCallback.onthrow"/>
</dubbo:reference>
- send a request in async mode.
When timeout occurred, demoCallback.onthrow callback have not been invoked.
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
onthrow callback should be invoked.
Actual Result
onthrow have not be invoked.
If there is an exception, please attach the exception trace:
Once exception occurs, CallbackRegistrationInvoker onError will be invoked
@Override
public Result invoke(Invocation invocation) throws RpcException {
Result asyncResult = filterInvoker.invoke(invocation);
asyncResult = asyncResult.whenCompleteWithContext((r, t) -> {
for (int i = filters.size() - 1; i >= 0; i--) {
Filter filter = filters.get(i);
// onResponse callback
if (filter instanceof ListenableFilter) {
Filter.Listener listener = ((ListenableFilter) filter).listener();
if (listener != null) {
if (t == null) {
listener.onResponse(r, filterInvoker, invocation);
} else {
listener.onError(t, filterInvoker, invocation);
}
}
} else {
filter.onResponse(r, filterInvoker, invocation);
}
}
});
return asyncResult;
}
But, the FutureListener's onError is not implemented, cannot invoke the onreturn/onerror callback.
class FutureListener implements Listener {
@Override
public void onResponse(Result result, Invoker<?> invoker, Invocation invocation) {
if (result.hasException()) {
fireThrowCallback(invoker, invocation, result.getException());
} else {
fireReturnCallback(invoker, invocation, result.getValue());
}
}
@Override
public void onError(Throwable t, Invoker<?> invoker, Invocation invocation) {
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.