{"record":{"id":"8e86e813499ac139","repo":"apache/shenyu","slug":"shared-thread-pool-is-not-enable-config-shenyu-sharedpool","errorCode":null,"errorMessage":"shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !","messagePattern":"shared thread pool is not enable, config (.+?) in your xml/yml !","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/threadpool/SharedThreadPool.java","lineNumber":38,"sourceCode":"import org.apache.dubbo.common.URL;\nimport org.apache.dubbo.common.threadpool.ThreadPool;\nimport org.apache.shenyu.common.concurrent.ShenyuThreadPoolExecutor;\nimport org.apache.shenyu.common.exception.ShenyuException;\nimport org.apache.shenyu.plugin.api.utils.SpringBeanUtils;\nimport org.springframework.beans.factory.NoSuchBeanDefinitionException;\n\nimport java.util.concurrent.Executor;\n\n/**\n * The type Shared Thread Pool.\n */\npublic class SharedThreadPool implements ThreadPool {\n    @Override\n    public Executor getExecutor(final URL url) {\n        try {\n            return SpringBeanUtils.getInstance().getBean(ShenyuThreadPoolExecutor.class);\n        } catch (NoSuchBeanDefinitionException t) {\n            throw new ShenyuException(\"shared thread pool is not enable, config ${shenyu.sharedPool.enable} in your xml/yml !\", t);\n        }\n    }\n}\n","sourceCodeStart":20,"sourceCodeEnd":42,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/threadpool/SharedThreadPool.java#L20-L42","documentation":"The Apache Dubbo plugin's SharedThreadPool tries to fetch the ShenyuThreadPoolExecutor Spring bean to share the gateway's thread pool with Dubbo requests. When that bean doesn't exist (NoSuchBeanDefinitionException) — because shared pool support was never enabled — it throws a ShenyuException telling the user to set shenyu.sharedPool.enable.","triggerScenarios":"A dubbo selector/rule (or plugin threadpool config) sets threadpool=shared while the bootstrap application does not define the ShenyuThreadPoolExecutor bean because shenyu.sharedPool.enable is false or absent.","commonSituations":"User copies a dubbo config example that uses 'shared' threadpool without enabling the shared pool in application.yml; a starter that creates the shared pool isn't on the classpath; config key was renamed or mistyped across versions.","solutions":["Set shenyu.sharedPool.enable: true in the gateway's application.yml so ShenyuThreadPoolExecutor is registered.","Verify shenyu-spring-boot-starter(-gateway) runtime components that create ShenyuThreadPoolExecutor are on the classpath.","Alternatively change the dubbo plugin's threadpool config from 'shared' to 'cached' or another supported type.","Restart the gateway after changing config so the bean is created before any dubbo call."],"exampleFix":"// before (application.yml)\nshenyu:\n  threadPool:\n    enable: false\n// after\nshenyu:\n  sharedPool:\n    enable: true","handlingStrategy":"validation","validationCode":"// before starting dubbo calls, check the bean exists\nApplicationContext ctx = SpringBeanUtils.getInstance().getApplicationContext();\nboolean shared = ctx.getBeansOfType(ShenyuThreadPoolExecutor.class).size() > 0;\nif (!shared && \"shared\".equals(threadpool)) {\n    throw new IllegalStateException(\"enable shenyu.sharedPool.enable=true\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Executor exec = sharedThreadPool.getExecutor(url);\n} catch (ShenyuException e) {\n    LOG.error(\"shared pool missing, falling back: {}\", e.getMessage());\n    Executor exec2 = new CachedThreadPool().getExecutor(url);\n}","preventionTips":["Always set shenyu.sharedPool.enable=true when any plugin uses threadpool=shared.","Add a startup smoke test that asserts ShenyuThreadPoolExecutor is present.","Keep threadpool config values consistent across dubbo/grpc/sofa/tars plugins.","Document the shared-pool prerequisite in deployment runbooks."],"tags":["dubbo","threadpool","configuration","spring"],"backgroundTag":"missing-required-config","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}