{"record":{"id":"23f4d0e0a8cec259","repo":"apache/shenyu","slug":"shared-thread-pool-is-not-enable-config-shenyu-sharedpool-23f4d0","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-grpc/src/main/java/org/apache/shenyu/plugin/grpc/client/GrpcClientBuilder.java","lineNumber":95,"sourceCode":"    }\n\n    /**\n     * get thread pool, just for integrated test.\n     *\n     * @return the thread pool\n     */\n    public static Executor buildExecutor() {\n        GrpcRegisterConfig config = Singleton.INST.get(GrpcRegisterConfig.class);\n        if (Objects.isNull(config)) {\n            return null;\n        }\n        final String threadpool = Optional.ofNullable(config.getThreadpool()).orElse(Constants.CACHED);\n        switch (threadpool) {\n            case Constants.SHARED:\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            case Constants.FIXED:\n            case Constants.EAGER:\n            case Constants.LIMITED:\n                throw new UnsupportedOperationException();\n            case Constants.CACHED:\n            default:\n                return null;\n        }\n    }\n}\n","sourceCodeStart":77,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-grpc/src/main/java/org/apache/shenyu/plugin/grpc/client/GrpcClientBuilder.java#L77-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set shenyu.sharedPool.enable: true in the gateway config so ShenyuThreadPoolExecutor exists.","Change the grpc threadpool config from 'shared' to 'cached' (the default) if a dedicated pool is acceptable.","Do not use fixed/eager/limited for grpc — they throw UnsupportedOperationException in this builder.","Ensure the shared-pool bean is created before grpc clients are built (correct starter/config order)."],"exampleFix":"// before (application.yml)\nshenyu:\n  grpc:\n    threadpool: shared\n// after\nshenyu:\n  sharedPool:\n    enable: true\n  grpc:\n    threadpool: cached","handlingStrategy":"validation","validationCode":"String tp = Optional.ofNullable(config.getThreadpool()).orElse(\"cached\");\nif (\"fixed\".equals(tp) || \"eager\".equals(tp) || \"limited\".equals(tp)) {\n    throw new IllegalArgumentException(\"grpc plugin does not support threadpool: \" + tp);\n}\nif (\"shared\".equals(tp) && !sharedPoolEnabled()) {\n    throw new IllegalArgumentException(\"enable shenyu.sharedPool.enable=true\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Executor executor = builder.buildExecutor(config);\n} catch (ShenyuException | UnsupportedOperationException e) {\n    LOG.error(\"executor build failed: {}\", e.getMessage());\n}","preventionTips":["Use threadpool=shared only with shenyu.sharedPool.enable=true.","For grpc, prefer 'cached' (the default) unless the shared pool is confirmed enabled.","Never configure fixed/eager/limited for grpc — unsupported by design.","Validate threadpool config in CI before deploying the gateway."],"tags":["grpc","threadpool","configuration"],"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"}