-
Notifications
You must be signed in to change notification settings - Fork 986
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
Connection pool deadlock #531
Comments
borrowObject and returnObject methods are no longer synchronized to use the pool synchronization and to solve a deadlock in which the pool is exhausted, a new connection is requested, and a connection cannot be returned to the pool because of instance-level locking. Previously, if a client got stuck in the borrowObject method (pool exhausted, long connect duration) and a concurrent thread tried to return the connection via returnObject, the second thread was blocked by the first thread. Synchronized methods use the object instance to create a synchronization lock. The instance was locked by the first thread and so the second thread had to wait (an indefinite time) for a release, that would likely never happen.
borrowObject and returnObject methods are no longer synchronized to use the pool synchronization and to solve a deadlock in which the pool is exhausted, a new connection is requested, and a connection cannot be returned to the pool because of instance-level locking. Previously, if a client got stuck in the borrowObject method (pool exhausted, long connect duration) and a concurrent thread tried to return the connection via returnObject, the second thread was blocked by the first thread. Synchronized methods use the object instance to create a synchronization lock. The instance was locked by the first thread and so the second thread had to wait (an indefinite time) for a release, that would likely never happen.
borrowObject and returnObject methods are no longer synchronized to use the pool synchronization and to solve a deadlock in which the pool is exhausted, a new connection is requested, and a connection cannot be returned to the pool because of instance-level locking. Previously, if a client got stuck in the borrowObject method (pool exhausted, long connect duration) and a concurrent thread tried to return the connection via returnObject, the second thread was blocked by the first thread. Synchronized methods use the object instance to create a synchronization lock. The instance was locked by the first thread and so the second thread had to wait (an indefinite time) for a release, that would likely never happen.
There's no need to have |
hi, could you pls confirm whether the follow bug is #531. The dumped stack is as follows, |
The 4.x line is no longer maintained. Please upgrade to 5.2.1.RELEASE. |
ok, 3ks |
Now I have upgraded to 5.0.0.release and it's deployed to three services which each has six clusters and runs about a week, there are two services that got the RedisCommandTimeoutException and the dumped stack is as follows "RedisHealthMonitor-0" #69 prio=5 os_prio=0 tid=0x00007f22bb283800 nid=0x5761 in Object.wait() [0x00007f22578f7000] "RedisConsistencyMonitor-0" #68 prio=5 os_prio=0 tid=0x00007f22bb281000 nid=0x5760 in Object.wait() [0x00007f22579f8000] Could you pls give me some advices? Thanks in advance. |
Could you please tell me whether lettuce 4.4 or 5.0 is compatible with redis 3.2.8? |
One the GenericObjectPool is drained, it will block and wait for a new connection (default behaviour, which is also something I like to keep). The problem is that it will never fire, since it will block inside a synchronized method you override, which also blocks any returnObject calls which would normally free a resource and stop the wait.
To reproduce: gist
Version: current 5.x branch
The text was updated successfully, but these errors were encountered: