apache/shenyu · error · ShenyuException

shared thread pool is not enable, config

Error message

shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !

What it means

GrpcClientBuilder.buildExecutor selects an executor based on the configured threadpool name. When 'shared' is configured it looks up the ShenyuThreadPoolExecutor bean; if absent (shared pool not enabled) it throws a ShenyuException instructing the user to enable shenyu.sharedPool.enable. 'fixed', 'eager' and 'limited' are explicitly unsupported and throw UnsupportedOperationException.

Solutions

  1. Set shenyu.sharedPool.enable: true in the gateway config so ShenyuThreadPoolExecutor exists.
  2. Change the grpc threadpool config from 'shared' to 'cached' (the default) if a dedicated pool is acceptable.
  3. Do not use fixed/eager/limited for grpc — they throw UnsupportedOperationException in this builder.
  4. Ensure the shared-pool bean is created before grpc clients are built (correct starter/config order).

Example fix

// before (application.yml)
shenyu:
  grpc:
    threadpool: shared
// after
shenyu:
  sharedPool:
    enable: true
  grpc:
    threadpool: cached
Defensive patterns

Strategy: validation

Validate before calling

String tp = Optional.ofNullable(config.getThreadpool()).orElse("cached");
if ("fixed".equals(tp) || "eager".equals(tp) || "limited".equals(tp)) {
    throw new IllegalArgumentException("grpc plugin does not support threadpool: " + tp);
}
if ("shared".equals(tp) && !sharedPoolEnabled()) {
    throw new IllegalArgumentException("enable shenyu.sharedPool.enable=true");
}

Try / catch

try {
    Executor executor = builder.buildExecutor(config);
} catch (ShenyuException | UnsupportedOperationException e) {
    LOG.error("executor build failed: {}", e.getMessage());
}

Prevention

When it happens

Trigger: A grpc plugin/selector config sets threadpool=shared while the ShenyuThreadPoolExecutor bean is not registered; also triggered by configuring threadpool=fixed|eager|limited for grpc.

Common situations: Shared pool not enabled in application.yml; grpc client built during plugin init before the shared pool bean exists; copying threadpool settings from a dubbo example where 'fixed' is valid but grpc rejects it.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/23f4d0e0a8cec259. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/client/GrpcClientBuilder.java:95

    }

    /**
     * get thread pool, just for integrated test.
     *
     * @return the thread pool
     */
    public static Executor buildExecutor() {
        GrpcRegisterConfig config = Singleton.INST.get(GrpcRegisterConfig.class);
        if (Objects.isNull(config)) {
            return null;
        }
        final String threadpool = Optional.ofNullable(config.getThreadpool()).orElse(Constants.CACHED);
        switch (threadpool) {
            case Constants.SHARED:
                try {
                    return SpringBeanUtils.getInstance().getBean(ShenyuThreadPoolExecutor.class);
                } catch (NoSuchBeanDefinitionException t) {
                    throw new ShenyuException("shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !", t);
                }
            case Constants.FIXED:
            case Constants.EAGER:
            case Constants.LIMITED:
                throw new UnsupportedOperationException();
            case Constants.CACHED:
            default:
                return null;
        }
    }
}

View on GitHub (pinned to 567142e072)