{"record":{"id":"de7922300e9d51b4","repo":"apache/shenyu","slug":"shared-thread-pool-is-not-enable-config-shenyu-sharedpool-de7922","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-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java","lineNumber":141,"sourceCode":"            initThreadPool(tarsRegisterConfig);\n            Optional.ofNullable(threadPool).ifPresent(this::setCommunicatorThreadPool);\n        }\n    }\n\n    /**\n     * init thread pool.\n     */\n    private void initThreadPool(final TarsRegisterConfig config) {\n        if (Objects.nonNull(threadPool)) {\n            return;\n        }\n        switch (config.getThreadpool()) {\n            case Constants.SHARED:\n                try {\n                    threadPool = SpringBeanUtils.getInstance().getBean(ShenyuThreadPoolExecutor.class);\n                    return;\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            case Constants.FIXED:\n            case Constants.EAGER:\n            case Constants.LIMITED:\n                throw new UnsupportedOperationException();\n            case Constants.CACHED:\n                int corePoolSize = Optional.ofNullable(config.getCorethreads()).orElse(0);\n                int maximumPoolSize = Optional.ofNullable(config.getThreads()).orElse(Integer.MAX_VALUE);\n                int queueSize = Optional.ofNullable(config.getQueues()).orElse(0);\n                threadPool = new ThreadPoolExecutor(corePoolSize, maximumPoolSize, 60L, TimeUnit.SECONDS,\n                        queueSize > 0 ? new LinkedBlockingQueue<>(queueSize) : new SynchronousQueue<>(), factory);\n                return;\n            default:\n        }\n    }\n\n    /**\n     * Set communicator thread pool.","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-tars/src/main/java/org/apache/shenyu/plugin/tars/cache/ApplicationConfigCache.java#L123-L159","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (application.yml)\nshenyu:\n  tars:\n    threadpool: shared\n// after\nshenyu:\n  sharedPool:\n    enable: true\n  tars:\n    threadpool: shared","handlingStrategy":"validation","validationCode":"if (\"shared\".equals(config.getThreadpool())\n        && SpringBeanUtils.getInstance().getApplicationContext()\n            .getBeansOfType(ShenyuThreadPoolExecutor.class).isEmpty()) {\n    throw new IllegalStateException(\"tars shared threadpool requires shenyu.sharedPool.enable=true\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    applicationConfigCache.init(tarsConfig);\n} catch (ShenyuException e) {\n    LOG.error(\"tars init failed: {}\", e.getMessage());\n}","preventionTips":["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."],"tags":["tars","threadpool","configuration","init"],"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"}