Code Monkey home page Code Monkey logo

Comments (4)

haolian9 avatar haolian9 commented on June 3, 2024

A client connection can be closed cleanly or abnormally. In the former case the client closes AMQP 0-9-1 (or 1.0, or STOMP, or MQTT) connection gracefully using a dedicated library function (method). In the latter case the client closes TCP connection or TCP connection fails. RabbitMQ will log both cases.

according to the docs of rabbitmq, it seems AmqpProtocol just simply close the underlying socket connection, without sending a proper close signal(?) to rabbitmq first.

Abruptly closed connections can be harmless.

althrough, i think implemeting the "normal close" is still good to have.

from trio-amqp.

smurfix avatar smurfix commented on June 3, 2024

I agree and it should close cleanly (when not crashing). I'll look into it (though it'll be a couple weeks before I can get to it). Pull requests welcome. ;-)

from trio-amqp.

haolian9 avatar haolian9 commented on June 3, 2024

according to the amqp 0-9-1 reference, there is a connection.close() command which corresponding to pamqp.commands.Connection.Close().

after dived into the code, and i think it could be caused by the following code:

Protocol.close():

    # see: https://github.com/python-trio/trio-amqp/blob/dd805fc93e668b4ae094609d4afefa4561e64ae4/async_amqp/protocol.py#L228
    await self.connection_closed.set()

    if not got_close:
        # ...

        # see: https://github.com/python-trio/trio-amqp/blob/dd805fc93e668b4ae094609d4afefa4561e64ae4/async_amqp/protocol.py#L248
        await self.wait_closed()
        # which simply call `self.connection_closed.wait()`

since connection_closed is always set before waiting, the later wait() does not work as expected.

from trio-amqp.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.