{"record":{"id":"24dfb4fb86f0323c","repo":"apache/shenyu","slug":"acquire-timeout-value-must-be-positive","errorCode":null,"errorMessage":"Acquire Timeout value must be positive","messagePattern":"Acquire Timeout value must be positive","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-httpclient/src/main/java/org/apache/shenyu/springboot/starter/plugin/httpclient/HttpClientFactory.java","lineNumber":180,"sourceCode":"            Optional.ofNullable(pool.getEvictionInterval()).map(Duration::ofMillis).ifPresent(builder::evictInBackground);\n            builder.metrics(pool.getMetrics());\n            return builder.build();\n        }\n    }\n\n    /**\n     * build fixed connection pool.\n     *\n     * @param pool    connection pool params\n     * @param builder connection provider builder\n     */\n    public void buildFixedConnectionPool(final Pool pool,\n                                         final Builder builder) {\n        if (pool.getMaxConnections() <= 0) {\n            throw new IllegalArgumentException(\"Max Connections value must be strictly positive\");\n        }\n        if (pool.getAcquireTimeout() < 0) {\n            throw new IllegalArgumentException(\"Acquire Timeout value must be positive\");\n        }\n        builder.maxConnections(pool.getMaxConnections())\n                .pendingAcquireTimeout(Duration.ofMillis(pool.getAcquireTimeout()))\n                .pendingAcquireMaxCount(-1);\n    }\n\n    /**\n     * build elastic connection provider pool.\n     *\n     * @param builder connection provider builder\n     */\n    public void buildElasticConnectionPool(final Builder builder) {\n        // about the args, please see https://projectreactor.io/docs/netty/release/reference/index.html#_connection_pool_2\n        builder.maxConnections(Integer.MAX_VALUE)\n                .pendingAcquireTimeout(Duration.ofMillis(0))\n                .pendingAcquireMaxCount(-1);\n    }\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-httpclient/src/main/java/org/apache/shenyu/springboot/starter/plugin/httpclient/HttpClientFactory.java#L162-L198","documentation":"For a fixed connection pool, the acquire timeout (milliseconds to wait for a connection from the pool) must be zero or positive; a negative value throws this IllegalArgumentException when building the Reactor Netty ConnectionProvider.","triggerScenarios":"shenyu.httpclient.pool.type=fixed with pool.acquireTimeout configured as a negative number.","commonSituations":"Using -1 to mean 'no wait' or 'infinite'; unit mistakes when converting from seconds; stale copied config from another product where -1 means infinite.","solutions":["Set shenyu.httpclient.pool.acquire-timeout to a non-negative millisecond value (e.g. 45000)","Remove the key to use the default acquire timeout","If 'infinite wait' is desired, use a very large positive value"],"exampleFix":"# before\nshenyu:\n  httpclient:\n    pool:\n      acquire-timeout: -1\n# after\nshenyu:\n  httpclient:\n    pool:\n      acquire-timeout: 45000","handlingStrategy":"validation","validationCode":"int acquire = env.getProperty(\"shenyu.httpclient.pool.acquire-timeout\", Integer.class, 45000);\nif (acquire < 0) {\n    throw new IllegalArgumentException(\"shenyu.httpclient.pool.acquire-timeout must be >= 0 (ms)\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    pool = env.bindProperties(Pool.class);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Acquire Timeout\")) {\n        log.error(\"acquire-timeout must be a non-negative millisecond value\");\n    } else throw e;\n}","preventionTips":["Remember timeouts are in milliseconds; avoid negative sentinels","Use defaults by omitting the key instead of setting -1","Validate pool properties in CI config checks"],"tags":["httpclient","connection-pool","validation","configuration"],"backgroundTag":"value-out-of-range","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"}