Skip to content

newConn race fix, fix check pool exhausted, replacing the MaxActiveConns parameter with PoolSizeStrict #2781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nvorobev
Copy link
Contributor

@nvorobev nvorobev commented Nov 1, 2023

This library implements non-standard pool behavior. Where the pool size is essentially not an honest pool size and can increase without limitation, which under heavy loads will lead to the server being flooded with connections.

PoolSizeStrict - enabling classic pool mode, when it is guaranteed that no more connections will open to the server than specified in PoolSize.

An example of classic pool behavior:

https://github.com/gomodule/redigo/blob/master/redis/pool.go#L147C1-L147C1

https://github.com/gomodule/redigo/blob/master/redis/pool.go#L247

@nvorobev nvorobev changed the title newConn race fix newConn race fix, replacing the MaxActiveConns parameter with PoolSizeStrict Nov 3, 2023
@nvorobev nvorobev changed the title newConn race fix, replacing the MaxActiveConns parameter with PoolSizeStrict newConn race fix, fix check pool exhausted, replacing the MaxActiveConns parameter with PoolSizeStrict Nov 3, 2023
@ofekshenawa
Copy link
Collaborator

@nvorobev Could you please add unit tests for this issue?

@ndyakov
Copy link
Member

ndyakov commented Mar 19, 2025

@nvorobev thank you for the contribution, please add tests so we can review the PR and proceed.

Comment on lines +182 to +187
// It is not allowed to add new connections to the closed connection pool.
if p.closed() {
_ = cn.Close()
return nil, ErrClosed
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should check if pool is closed before potential dialconn call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants