Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

connection.close() Been waiting | help me #640

Open
Y7000-save-me opened this issue Jul 26, 2024 · 2 comments
Open

connection.close() Been waiting | help me #640

Y7000-save-me opened this issue Jul 26, 2024 · 2 comments

Comments

@Y7000-save-me
Copy link

async def disconnect(self):
if self.connection and not self.connection.is_closed:
logger.info(f"close RabbitMQ connection1")
try:
await self.connection.close()
logger.info(f"close RabbitMQ connection2")
except Exception as e:
logger.error(f"Failed to close RabbitMQ connection: {e}")

async def on_shutdown():
await rabbit_mq.disconnect()

app.add_event_handler("shutdown", on_shutdown)

log
INFO: Shutting down
INFO: Waiting for application shutdown.
2024-07-26 16:42:28.703 | INFO | agentic.base.mq.client:disconnect:52 - close RabbitMQ connection1

The connection won't shut down

@antonparshukov00
Copy link

Version: aio-pika 9.4.1
Faced same/similar problem. Code is waiting forever on the closing. Will try to explore more.
image

@unkcpz
Copy link

unkcpz commented Dec 20, 2024

I got the same issue (and same code path of exception as @antonparshukov00). I spend sometime to dig out the cause.

The problem might be that the await self.close_callback.wait() of aio_pika/abc.py::UnderlayConnection.close didn't get chance to resolve the future.

I propose a solution in mosquito/aiormq#208.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants