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
ApplicationConfigCache.initThreadPool for the TARS plugin mirrors the SOFA/Dubbo logic: with threadpool=shared it fetches ShenyuThreadPoolExecutor from Spring and throws ShenyuException when the bean doesn't exist (shared pool disabled), while fixed/eager/limited throw UnsupportedOperationException.
Solutions
- Set shenyu.sharedPool.enable: true in application.yml and restart.
- Or switch the tars threadpool config to 'cached'.
- Verify the ShenyuThreadPoolExecutor bean is actually registered (check startup logs / dependency list).
- Avoid fixed/eager/limited threadpool values for tars — they are unsupported.
Example fix
// before (application.yml)
shenyu:
tars:
threadpool: shared
// after
shenyu:
sharedPool:
enable: true
tars:
threadpool: shared Defensive patterns
Strategy: validation
Validate before calling
if ("shared".equals(config.getThreadpool())
&& SpringBeanUtils.getInstance().getApplicationContext()
.getBeansOfType(ShenyuThreadPoolExecutor.class).isEmpty()) {
throw new IllegalStateException("tars shared threadpool requires shenyu.sharedPool.enable=true");
} Try / catch
try {
applicationConfigCache.init(tarsConfig);
} catch (ShenyuException e) {
LOG.error("tars init failed: {}", e.getMessage());
} Prevention
- Set shenyu.sharedPool.enable=true when tars threadpool=shared.
- Use 'cached' threadpool to avoid the shared-pool dependency.
- Assert ShenyuThreadPoolExecutor bean presence in startup checks.
- Avoid fixed/eager/limited values — unsupported by the tars cache initializer.
When it happens
Trigger: tars plugin configuration has threadpool=shared while the ShenyuThreadPoolExecutor bean is absent because shenyu.sharedPool.enable is not true; initThreadPool runs during plugin cache initialization.
Common situations: Enabling the tars plugin without enabling the shared pool; copying shared-threadpool config from docs without adding shenyu.sharedPool.enable; bean missing due to missing starter dependency.
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
- shared thread pool is not enable, config
- shared thread pool is not enable, config
- shared thread pool is not enable, config
- shenyu.jwt.secretKey is not configured. In a multi-instance…
- shenyu discovery mode current didn't support
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/de7922300e9d51b4.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java:141
initThreadPool(tarsRegisterConfig);
Optional.ofNullable(threadPool).ifPresent(this::setCommunicatorThreadPool);
}
}
/**
* init thread pool.
*/
private void initThreadPool(final TarsRegisterConfig config) {
if (Objects.nonNull(threadPool)) {
return;
}
switch (config.getThreadpool()) {
case Constants.SHARED:
try {
threadPool = SpringBeanUtils.getInstance().getBean(ShenyuThreadPoolExecutor.class);
return;
} 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:
int corePoolSize = Optional.ofNullable(config.getCorethreads()).orElse(0);
int maximumPoolSize = Optional.ofNullable(config.getThreads()).orElse(Integer.MAX_VALUE);
int queueSize = Optional.ofNullable(config.getQueues()).orElse(0);
threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 60L, TimeUnit.SECONDS,
queueSize > 0 ? new LinkedBlockingQueue<>(queueSize) : new SynchronousQueue<>(), factory);
return;
default:
}
}
/**
* Set communicator thread pool.View on GitHub (pinned to 567142e072)