Skip to content

fix(pool): reject negative minimum idle configuration - #6738

Open
cangen185-sudo wants to merge 1 commit into
alibaba:masterfrom
cangen185-sudo:codex/fix-negative-min-idle
Open

cangen185-sudo wants to merge 1 commit into
alibaba:masterfrom
cangen185-sudo:codex/fix-negative-min-idle

Conversation

@cangen185-sudo

@cangen185-sudo cangen185-sudo commented Oct 15, 2026 •

Copy link
Copy Markdown

Description

Reject negative incoming minIdle values in both the setter and property-configuration paths.

DruidAbstractDataSource.setMinIdle(int value) currently checks the old minIdle field rather than value, so setMinIdle(-1) is accepted from a normal nonnegative state. DruidDataSource.configFromProperties() also assigns druid.minIdle directly, bypassing that setter.

Check value < 0, and route the property assignment through setMinIdle(). Keep the existing paired maxActive/minIdle validation and the order that applies the new maximum before the new minimum. Valid zero/positive values retain their behavior.

Reproduction and validation

Four added regressions cover negative values through the setter and properties, each before and after initialization. They verify that rejected input leaves the previous minimum unchanged and subsequent valid values remain usable. The initialized cases use the repository's existing mock JDBC driver.

Test stage Code under test Result
Current local recheck after the fix Exact PR commit 82f4149ca41827b1cd64241e7b6e0684dba02a24, after a clean compilation 18 tests passed, 0 failed, 0 errors, 0 skipped.
Defect reproduction before the fix Original production code The 4 new regression tests failed as expected; 9 existing tests passed. Each failure accepted invalid input instead of throwing.

Current verification command:

mvn -B -ntp -pl core -Dtest=DruidDataSourceTest4,ParamTest,DruidDataSourceTest_maxActive3,DruidDataSourceTest_maxActive4,MaxActiveChangeTest clean test
  • Repository Checkstyle: 0 violations; core production and test compilation passed.
  • git diff --check: passed.
  • Windows 11, Microsoft OpenJDK 17.0.20.1, Maven 3.9.11. No external database or full-repository runtime test pass is claimed.

Scoped Issue/PR searches for minIdle, setMinIdle and negative minimums found no equivalent open repair. Historical #5558/#5562 concern error-message wording, not this incoming-value and property-path defect.

The contributor has signed the CLA; the live license/cla check passed. GitHub Actions still requires maintainer approval.

Codex assisted with audit, reproduction, implementation and validation. A bounded read-only review checked the paired property-reload semantics. Ready for maintainer review.

@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@cangen185-sudo
cangen185-sudo marked this pull request as ready for review October 15, 2026 01:27
@cangen185-sudo
cangen185-sudo marked this pull request as draft October 15, 2026 01:28
@cangen185-sudo
cangen185-sudo marked this pull request as ready for review October 15, 2026 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants