Version: 4.3.4, but the code that causes the issue still exists in master
Platform: Python 3.11
Description: In rare cases, there's a deadlock in class Pipeline. The class resets it's connection in the __del__ method (in case the connection wasn't closed beforehand). __del__ is called when the object is deleted, and can be inserted by the GC anywhere in the code. In my cause, __del__ was inserted in method get_connection of ConnectionPool after it acquired self._lock. The __del__'s reset method calls self.connection_pool.release, which tries to acquire the same lock (self._lock), and everything is stuck in a deadlock.
One way to solve this issue would be to use an rlock.
Version: 4.3.4, but the code that causes the issue still exists in master
Platform: Python 3.11
Description: In rare cases, there's a deadlock in class
Pipeline
. The class resets it's connection in the__del__
method (in case the connection wasn't closed beforehand).__del__
is called when the object is deleted, and can be inserted by the GC anywhere in the code. In my cause,__del__
was inserted in methodget_connection
ofConnectionPool
after it acquiredself._lock
. The__del__
's reset method callsself.connection_pool.release
, which tries to acquire the same lock (self._lock
), and everything is stuck in a deadlock.One way to solve this issue would be to use an rlock.