Skip to content

Drop inactive Redis connections from the free pool - #7253

Open
HarshDevelops wants to merge 1 commit into
redisson:masterfrom
HarshDevelops:fix/7236-inactive-connection-pool
Open

Drop inactive Redis connections from the free pool#7253
HarshDevelops wants to merge 1 commit into
redisson:masterfrom
HarshDevelops:fix/7236-inactive-connection-pool

Conversation

@HarshDevelops

Copy link
Copy Markdown

Fixes #7236

What was wrong

When a Netty channel was closed without RedisConnection.closeAsync() (for example after a PING timeout), RedisConnection.closed stayed false while isActive() became false. ConnectionsHolder still put those entries back into the free pool. They could be borrowed again, and later writes failed with write timeouts.

What changed

ConnectionsHolder now discards inactive free-pool entries and marks them closed instead of re-queueing them. PingConnectionHandler closes the RedisConnection (not only the channel) on PING timeout so the closed flag is set.

Testing

  • RED: ConnectionsHolderTest inactive-connection tests fail without the pool change
  • GREEN: mvn -pl redisson -Dtest=ConnectionsHolderTest test - 4 tests, 0 failures (JDK 25)
  • Signed-off-by (DCO)

ConnectionsHolder re-queued free-pool entries whose Netty channel was
inactive but RedisConnection.closed was still false (for example after
PingConnectionHandler closed the channel without closeAsync). Those
entries could be borrowed again and surface as write timeouts.

Drop inactive connections from the free pool and mark them closed on
PING timeout so they cannot be reused.

Fixes redisson#7236

Signed-off-by: Harsh Srivastava <harsh10822@gmail.com>

@mrniko mrniko left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't already fixed in 6c4fc52 ?

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

ConnectionPool can reuse inactive RedisConnection after channel close, causing "Command still hasn't been written" timeouts

2 participants