{"record":{"id":"4ba758d7a3015e14","repo":"alibaba/druid","slug":"maxactive-less-than-minidle","errorCode":null,"errorMessage":"maxActive less than minIdle, {} < {}","messagePattern":"maxActive less than minIdle, (.+?) < (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java","lineNumber":300,"sourceCode":"                    LOG.info(\"password changed\");\n                }\n                incrementUserPasswordVersion();\n            }\n\n            {\n                Integer initialSize = DruidDataSourceUtils.getPropertyInt(properties, \"druid.initialSize\");\n                if (initialSize != null) {\n                    this.initialSize = initialSize;\n                }\n            }\n\n            Integer maxActive = DruidDataSourceUtils.getPropertyInt(properties, \"druid.maxActive\");\n            Integer minIdle = DruidDataSourceUtils.getPropertyInt(properties, \"druid.minIdle\");\n            if (maxActive != null || minIdle != null) {\n                int compareMaxActive = maxActive != null ? maxActive.intValue() : this.maxActive;\n                int compareMinIdle = minIdle != null ? minIdle.intValue() : this.minIdle;\n                if (compareMaxActive < compareMinIdle) {\n                    throw new IllegalArgumentException(\"maxActive less than minIdle, \" + compareMaxActive + \" < \" + compareMinIdle);\n                }\n            }\n            if (maxActive != null) {\n                this.maxActive = maxActive;\n            }\n            if (minIdle != null) {\n                this.minIdle = minIdle;\n            }\n\n            DruidDataSourceUtils.configFromProperties(this, properties);\n        } finally {\n            lock.unlock();\n        }\n\n        int replaceCount = 0;\n        // replace older version urlUserPassword Connection\n        while ((hasOlderVersionUrlUserPasswordConnection())) {\n            try {","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/alibaba/druid/blob/fa8dc9912637a2f729eef9f55356621fec18d40e/core/src/main/java/com/alibaba/druid/pool/DruidDataSource.java#L282-L318","documentation":"IllegalArgumentException thrown while loading pool sizing from a Properties map (configFromProperties path) when the resolved maxActive is less than the resolved minIdle. Druid derives compareMaxActive/compareMinIdle from the properties (falling back to current field values) and rejects an inverted sizing before applying it.","triggerScenarios":"Properties containing druid.maxActive and/or druid.minIdle where the effective maxActive < effective minIdle. The check at line 296 throws before any field is mutated.","commonSituations":"A properties file / System properties overriding only one of the two (e.g. druid.minIdle=10 left in place while druid.maxActive=8 is applied); copying config between environments with different pool sizes; unit misconfiguration.","solutions":["Make druid.maxActive >= druid.minIdle in your properties/source.","If only one is overridden, ensure the default for the other is not larger.","Audit the full set of druid.* properties loaded (log them at startup) to find the conflicting override."],"exampleFix":"# before\ndruid.maxActive=8\ndruid.minIdle=10\n# after\ndruid.maxActive=20\ndruid.minIdle=5","handlingStrategy":"validation","validationCode":"int max = props.getProperty(\"druid.maxActive\") != null\n    ? Integer.parseInt(props.getProperty(\"druid.maxActive\")) : currentMax;\nint min = props.getProperty(\"druid.minIdle\") != null\n    ? Integer.parseInt(props.getProperty(\"druid.minIdle\")) : currentMin;\nif (max < min) {\n    throw new IllegalArgumentException(\"druid.maxActive=\" + max + \" must be >= druid.minIdle=\" + min);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure maxActive and minIdle as a coordinated pair.","Unit-test config files for the maxActive >= minIdle invariant.","Log resolved sizing at startup."],"tags":["config","pool-sizing","properties","validation"],"backgroundTag":null,"analyzedSha":"fa8dc9912637a2f729eef9f55356621fec18d40e","analyzedAt":"2026-08-14T04:55:06.789Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}