Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_cluster: fix deadlock in
NodeProxy
`NodeProxy` acts as a proxy server that connects to Valkey. In its handler, it creates two pipes: 1. Connecting valkey reader to own writer 2. Connecting own reader to valkey writer Then, it `await`s on these two pipes via `asyncio.gather`. `asyncio.gather` itself returns a future that can be canceled, and originally it was assumingly thought that canceling `self.task` in `NodeProxy` would cancel the pipes, too. That was not the case. This behaviour caused warnings in Python 3.9. On Python 3.12, it caused a deadlock. In order to fix it, the pipes future should be assigned to a variable so that it can be canceled explicitly upon `aclose()`. Additionally, the `NodeProxy`'s handler should handle a situation when pipes future was canceled and close the `Writer` side in order for the loop to end gracefully. This commit introduces `self.pipes` in `NodeProxy` and handles the cancellation properly therefore fixing the deadlock. Signed-off-by: Mikhail Koviazin <[email protected]>
- Loading branch information