Skip to content

PoolConstraints infinite wait when the max value Is zero #397

@powerumc

Description

@powerumc

Thank you for creating such a useful crate.

I encountered an issue when I set the pool size constraints to PoolConstraints::new(0, 0), which results in an infinite wait for a connection. You can reproduce the problem with the following code:

let pool_constraints = PoolConstraints::new(0, 0).unwrap();
let pool = Pool::new(get_opts().pool_opts(PoolOpts::default().with_constraints(pool_constraints))).unwrap();
let conn = pool.get_conn();

Of course, I did not intentionally set the pool size to 0. The values for min and max are defined in a JSON configuration file that users can modify. If there is a typo in the property name or an incorrect value is provided, this issue could easily occur. In such cases, I believe additional validation is necessary.

I would like to write and submit a PR to address this. Please review. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions