apache/dubbo · error · RpcException

Rpc cluster invoker for {getInterface()} on consumer {NetUti

Error message

Rpc cluster invoker for {getInterface()} on consumer {NetUtils.getLocalHost()} use dubbo version {Version.getVersion()} is now destroyed! Can not invoke any more.

What it means

Thrown by AbstractClusterInvoker.checkWhetherDestroyed() when the cluster invoker's 'destroyed' AtomicBoolean is true. The cluster invoker wraps a Directory and performs the cluster strategy (failover/failfast/etc.); once destroyed it rejects all further invokes. This is the cluster-level counterpart to the directory-destroyed error.

Source

Thrown at dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java:374

        InvocationProfilerUtils.releaseDetailProfiler(invocation);

        checkInvokers(invokers, invocation);

        LoadBalance loadbalance = initLoadBalance(invokers, invocation);
        RpcUtils.attachInvocationIdIfAsync(getUrl(), invocation);

        InvocationProfilerUtils.enterDetailProfiler(
                invocation, () -> "Cluster " + this.getClass().getName() + " invoke.");
        try {
            return doInvoke(invocation, invokers, loadbalance);
        } finally {
            InvocationProfilerUtils.releaseDetailProfiler(invocation);
        }
    }

    protected void checkWhetherDestroyed() {
        if (destroyed.get()) {
            throw new RpcException(
                    "Rpc cluster invoker for " + getInterface() + " on consumer " + NetUtils.getLocalHost()
                            + " use dubbo version " + Version.getVersion()
                            + " is now destroyed! Can not invoke any more.");
        }
    }

    @Override
    public String toString() {
        return getInterface() + " -> " + getUrl().toString();
    }

    protected void checkInvokers(List<Invoker<T>> invokers, Invocation invocation) {
        if (CollectionUtils.isEmpty(invokers)) {
            throw new RpcException(
                    RpcException.NO_INVOKER_AVAILABLE_AFTER_FILTER,
                    "Failed to invoke the method "
                            + RpcUtils.getMethodName(invocation) + " in the service "
                            + getInterface().getName()

View on GitHub (pinned to 3a3043227f)

Solutions

  1. Stop issuing RPCs before destroying the reference; coordinate shutdown so callers drain first.
  2. Guard late-lifecycle calls with clusterInvoker.isDestroyed() (or check the reference) before invoking.
  3. Fix shutdown ordering so the Dubbo module/reference is destroyed only after all caller threads are stopped.

Example fix

// before: invoke after destroy
referenceConfig.destroy();
service.foo(); // checkWhetherDestroyed() throws

// after: guard
if (!clusterInvoker.isDestroyed()) {
    service.foo();
}
Defensive patterns

Strategy: validation

Validate before calling

// Guard against invoking a destroyed cluster invoker
if (clusterInvoker.isDestroyed()) {
    return null; // or throw a domain-specific exception
}
return clusterInvoker.invoke(invocation);

Try / catch

try {
    return clusterInvoker.invoke(invocation);
} catch (RpcException e) {
    if (e.getMessage().contains("is now destroyed")) {
        // reference torn down; degrade gracefully, do not retry
        log.warn("Cluster invoker destroyed; skipping call");
        return fallback();
    }
    throw e;
}

Prevention

When it happens

Trigger: Invoking through a Dubbo service reference whose ClusterInvoker has been destroyed — after ReferenceConfig.destroy(), Spring container shutdown, or the consumer being unsubscribed. checkWhetherDestroyed() is called at the start of each cluster invoke and on each failover retry.

Common situations: Application shutdown while business threads still call the service; a cached/stale service proxy used after its reference was destroyed; hot redeploy replacing the reference; in-flight failover retries where the invoker is destroyed mid-retry.

Related errors


AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14). Data as JSON: /api/errors/5bf0bdacdd71926d. Report an issue: GitHub.