Skip to content

Validate shard id is less than shard count before indexing pools #1696

@dkropachev

Description

@dkropachev

The connection pool trusts the shard id reported by the server and later indexes the per-shard connection array with it.

Code permalink:

let shard_info = connection.get_shard_info().as_ref();

Shard metadata validation ensures the shard count is nonzero, but it does not reject a shard id greater than or equal to the shard count. A malformed or buggy server response can therefore panic the pool worker instead of being treated as invalid sharding information.

Suggested direction: validate that the reported shard id is strictly less than the reported shard count before resizing/indexing the per-shard pool state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai-assistedarea/connectingOpening new connections, managing connection pool.bugSomething isn't workinggood first issueGood for newcomers

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions