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

Set closing future result #208

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

unkcpz
Copy link

@unkcpz unkcpz commented Dec 20, 2024

resolve deadlock when closing the connection.

I got the problem from aio-pika when closing the connection, the closing is always end up with timeout. I narrow down the problem to aiormq that the callbacks (which is _on_connection_close method of aio_pika.Connection class) of UnderlayConnection as the transport of Connection was never got chances to run.
The callbacks are triggered by self.closing.add_done_callback(close_callback), but in aiormq where the self.closing defined, it never get result resolved.

The change I did here is to set result of self.closing future as the last step of closing a connection so that all the attached callbacks get chance to run after.

@unkcpz
Copy link
Author

unkcpz commented Dec 20, 2024

@mosquito I guess this is a bug, can you have a look at it? It can solve the issue of mosquito/aio-pika#640.

@unkcpz unkcpz force-pushed the Drive-closing-callbacks branch from f4da0ad to 6cd8f50 Compare December 20, 2024 11:11
Solve deadlock when closing the connection
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 this pull request may close these issues.

1 participant