Skip to content
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

Fixed a bug that ConnectionPool holds the same Redis client. #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

alpaca-tc
Copy link

@alpaca-tc alpaca-tc commented Sep 26, 2024

When pool_size or pool_timeout is passed as an option, Redis::Rack::Connection builds a ConnectionPool. ConnectionPool will execute a given block when there are not enough connections. However, since the calling store is cached in an instance variable, all connections held by the ConnectionPool are actually same objects.

It seems like something fatal would occur, but since there are no reports in the issues, maybe the existing implementation is no problem.

NOTE: This bug does not affect the following users:

  • Users who specify threadsafe: true.
  • Users who do not pass the threadsafe option.
  • Users who directly pass the pool as options, such as { pool: ConnectionPool.new(...) }.

When `pool_size` or `pool_timeout` is passed as an option, `Redis::Rack::Connection` builds a `ConnectionPool`.
`ConnectionPool` will execute a given block when there are not enough connections. However, since the calling store is cached in an instance variable, all connections held by the `ConnectionPool` are actually same objects.
@alpaca-tc alpaca-tc requested a review from tubbo as a code owner September 26, 2024 09:18
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.

1 participant