Skip to content

Possible deadlock in class Pipeline #3289

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

Open
zviRosenfeldRedis opened this issue Jun 25, 2024 · 1 comment · May be fixed by #3654
Open

Possible deadlock in class Pipeline #3289

zviRosenfeldRedis opened this issue Jun 25, 2024 · 1 comment · May be fixed by #3654

Comments

@zviRosenfeldRedis
Copy link

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.

@alessio-locatelli
Copy link

Could you please include a small MRE (minimal reproducible example)?

@vladvildanov vladvildanov linked a pull request May 23, 2025 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants