Clifford Jansen created PROTON-2897:
---------------------------------------

             Summary: Proton graceful AMQP protocol connection close vs 
immediate socket close
                 Key: PROTON-2897
                 URL: https://issues.apache.org/jira/browse/PROTON-2897
             Project: Qpid Proton
          Issue Type: Improvement
          Components: proton-c
    Affects Versions: proton-c-0.40.0
            Reporter: Clifford Jansen
            Assignee: Clifford Jansen
         Attachments: hbhang.c

On a protocol error at the AMQP connection level (such as idle timeout 
exceeded), the Proton core engine shuts down its virtual input but leaves the 
output open to make a best efforts processing of pending frames to send to the 
peer.  This includes the connection close frame and associated error condition.

In the normal case, these frames are written into the OS socket and become the 
responsibility of the OS to handle problems that may arise on the wire.  After 
Proton has sent the last frame, the transport is closed in both directions and 
the socket can be closed and the PN_TRANSPORT_CLOSED is emitted.

In the less normal (but not abnormal) case, the output to peer may be backed up 
such that the OS refuses to accept new outgoing protocol frames.  In this case, 
Proton waits for the OS to eventually accept the pending output or tell Proton 
the socket is dead.  It may surprise the application using Proton that this may 
take many minutes depending on the underlying platform and how it is configured.

This "surprising" behavior could be addressed by several means.  Better 
documentation. Acceptance that the OS decision of when to give up on a socket 
is appropriate.  Introduce a new connection parameter that sets a maximum 
error-to-transport-closed time.

An example of better documentation would be highlighting how the application 
could use pn_transport_close_head() to force discarding pending output and 
cleanup of the connection resources, immediately or at a timed delay.  This is 
demonstrated in the attached sample program.

Sadly, at the moment pn_transport_close_head() is a deprecated API, and there 
is no alternative functionality yet surfaced for use by the application.  The 
connection_driver for a particular connection cannot be queried from the Proton 
core or Proactor APIs.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to