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

Fail to second call pool.borrowObject() using StatefulRedisMasterSlaveConnection in 4.3.0.Final #411

Closed
krisjey opened this issue Nov 25, 2016 · 2 comments
Labels
type: bug A general bug
Milestone

Comments

@krisjey
Copy link

krisjey commented Nov 25, 2016

Hello, guys.

I'm trying to change Redis client library Jedis to Lettuce.
Major reason is that data read from the slave.

I rewrote the class for Jedis pooling. and then tested.
but Lettuce said an error like below.

com.lambdaworks.redis.RedisException: Connection is deallocated and cannot be used anymore.

Note.
I used two kind of redis settings. One is master-slave, the other one is redis cluster.
StatefulRedisClusterConnection is working fine.

So, I found some test cases for StatefulRedisMasterSlaveConnection in Lettuce codebase and then change test cases.

https://gist.github.com/krisjey/58f16d4792d606596a47b01a68c2eb3b

<script src="https://gist.github.com/krisjey/58f16d4792d606596a47b01a68c2eb3b.js"></script>

But, Error is same.

Could you give me some clue?

@mp911de mp911de added the type: bug A general bug label Nov 25, 2016
@mp911de
Copy link
Collaborator

mp911de commented Nov 25, 2016

Hi @krisjey

ConnectionPoolSupport suffers from a bug in which the connection proxy (that returns the connection back to the pool on .close()) gets into a closed state but is not able to recover from this state once a new connection is obtained from the pool.

As rule of thumb, don't use connection pooling. There are only very few use-cases that make sense for pooling.

If you still require connection pooling, then return your connection yourself to the pool with pool.returnObject(connection).

mp911de added a commit that referenced this issue Nov 29, 2016
Connection pooling no longer pools proxies but wraps objects returned by the object pool. The proxy state is still invalidated which makes references to the proxy unusable once the connection is released back to the pool but the proxy instance it self is not pooled. Retrieval of the same connection will create a fresh proxy instance.
mp911de added a commit that referenced this issue Nov 29, 2016
Connection pooling no longer pools proxies but wraps objects returned by the object pool. The proxy state is still invalidated which makes references to the proxy unusable once the connection is released back to the pool but the proxy instance it self is not pooled. Retrieval of the same connection will create a fresh proxy instance.
@mp911de
Copy link
Collaborator

mp911de commented Nov 29, 2016

That's fixed now. You might give 4.4.0-SNAPSHOT a spin.

@mp911de mp911de closed this as completed Nov 29, 2016
@mp911de mp911de added this to the Lettuce 4.4.0 milestone Nov 29, 2016
@mp911de mp911de modified the milestones: Lettuce 4.3.1, Lettuce 4.4.0 Jan 27, 2017
mp911de added a commit that referenced this issue Jan 27, 2017
Connection pooling no longer pools proxies but wraps objects returned by the object pool. The proxy state is still invalidated which makes references to the proxy unusable once the connection is released back to the pool but the proxy instance it self is not pooled. Retrieval of the same connection will create a fresh proxy instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants