Open benko233 opened 1 month ago
Will the next invocation success after registry refresh finished?
My question is why the process is interrupted?
My question is why the process is interrupted?
I'm not sure whether the process is interrupted by next retry.
My connection timeout is 3000ms. If it always fails to connect, each retry will take 3000+1000+3000+1000+3000+1000=12000ms. However, the retry period is 10000ms.
My question is why the process is interrupted?
I'm not sure whether the process is interrupted by next retry.
My connection timeout is 3000ms. If it always fails to connect, each retry will take 3000+1000+3000+1000+3000+1000=12000ms. However, the retry period is 10000ms.
Actually, this is a bug. The metadata retry thread calls retryFuture.cancel(true)
, which will interrupt itself and then throw InterruptedException when trying lock.
My question is why the process is interrupted?
I'm not sure whether the process is interrupted by next retry. My connection timeout is 3000ms. If it always fails to connect, each retry will take 3000+1000+3000+1000+3000+1000=12000ms. However, the retry period is 10000ms.
Actually, this is a bug. The metadata retry thread calls
retryFuture.cancel(true)
, which will interrupt itself and then throw InterruptedException when trying lock.
Do you have some thoughts on how we can fix this issue?
it seems no multi thread makes flow clean and clear.
private synchronized void doOnEvent(ServiceInstancesChangedEvent event) {
getRemoteMetadata();
int emptyNum = parseMetadata();
if (emptyNum == allInstances.size()) {
return;
}
notify();
if (emptyNum > 0) {
doOnEvent(event);
}
}
Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
OpenJDK1.8, Dubbo 3.2.14
Steps to reproduce this issue
When consumer failed to get meatadata from provider, consumer would use MetadataRetryExecutor to retry, which may cause all invocations of consumer failed.
Debug Info
ServiceInstancesChangedListener uses MetadataRetryExecutor to refresh metadata when consumer lacks metadata of some instances. (ServiceInstancesChangedListener#doOnEvent)
ServiceDiscoveryRegistryDirectory refreshes routers' invokers synchronously while refreshes its invokers asynchronously. (ServiceDiscoveryRegistryDirectory #refreshInvoker)
If metadata retry thread is interrupted, ServiceDiscoveryRegistryDirectory will fail to fresh its invokers. Meanwhile routers has refreshed invokers.
When consumer lists valid invokers for invocation, SingleRouterChain will throw an IllegalStateException because of the inconsistence of invokers.
What you expected to happen
ServiceDiscoveryRegistryDirectory refreshes its invokers and router's consistently
Anything else
Are you willing to submit a pull request to fix on your own?
Code of Conduct