connectionProvider.release() doesn't really discard the connection after connection invalidated.
Inside validateConnection, called resetConnection(), and then called release(), but the action of release() does not necessarily discard the connection.
So, getNativeConnection() probably get a same channel(TCP) which is invalid.
We've actually tested this, and the result is that still get the same tcp connection after resetConnection many times.
somebody help
discardIfNecessary resets the Redis transaction state using Redi's DISCARD command. pool.returnObject(…) is what you're looking for. You need to configure pool object validation via GenericObjectPoolConfig.testOnBorrow to check for connected Redis connections.
probably get a same channel(TCP) which is invalid.
Care to elaborate what invalid means for you? In which state is the connection?
discardIfNecessaryresets the Redis transaction state using Redi'sDISCARDcommand.pool.returnObject(…)is what you're looking for. You need to configure pool object validation viaGenericObjectPoolConfig.testOnBorrowto check for connected Redis connections.probably get a same channel(TCP) which is invalid.
Care to elaborate what invalid means for you? In which state is the connection?
async().discard() not invoked because redisConnection.isMuti()==false, so, connection will not be discarded and it will be return to pool.
channel invalid means connection.sync().ping() failed and throw a timeout exception.
configure pool object validation via GenericObjectPoolConfig.testOnBorrow to check for connected Redis connections
Maybe this is a way to go, I just assumed that since SharedConnection provided a validateConnection, that it should achieve a similar result, right? Because connection.sync().ping() did fail.
One idea could be introducing a validation function or a depth of validation. For this to work, the Lettuce driver would need to introduce a Predicate<T extends StatefulConnection> to ConnectionPoolSupport.
This should be addressed with Lettuce 6.6.0