haproxy-spoa-dotnet icon indicating copy to clipboard operation
haproxy-spoa-dotnet copied to clipboard

Abort is not implemented

Open NickMRamirez opened this issue 5 years ago • 4 comments

The SPOE specification defines an "Abort" flag on the metadata field as:

ABORT: Indicates that the processing of the current frame must be
           cancelled. This bit should be set on frames with a fragmented
           payload. It can be ignore for frames with an unfragemnted
           payload. When it is set, the FIN bit must also be set.

This is not yet implemented in this library.

NickMRamirez avatar May 13 '20 02:05 NickMRamirez

Spec is not clear if both HaProxy and Agent can send Abort.

If Haproxy send a abort frame, the current fragmented buffer should be discard.

Current HandleStream implementation cannot be stopped. If it were possible, i think of two possibles cases before sending Disconnect frame (again not clear in the spec) :

  • Agent should send abort frame for any existing fragments in the catalog, to tell Haproxy that frame being sent to the agent will not be processed.
  • If agent was sending a fragmented frame, it may send an abort frame, to tell Haproxy that it will not send the complete frame.

SetVariable data type are synchronous, if the binary one was read from a stream while sending the fragment frame and the stream failed, agent may send an abort frame.

Do you have a better understanding of the spec and possible evolution ?

cortex93 avatar May 19 '20 18:05 cortex93

I agree, the spec is not clear about whether an agent can send an Abort. It only shows an example of a Notify frame from HAProxy aborting, so I think that's all that can be implemented for now. I have accepted your pull request, thanks!

NickMRamirez avatar May 28 '20 03:05 NickMRamirez

Looking at the spec again, there is an example of the agent aborting incoming fragments from HAProxy:

* Aborted fragmentation of a NOTIFY frame:

    HAPROXY                       AGENT SRV
       |            ...              |
       |       UNSET (frag X)        |
       | --------------------------> |
       |                             |
       |         ACK/ABORT           |
       | <-------------------------- |
       |                             |
       |       UNSET (frag X+1)      |
       | -----------X                |
       |                             |
       |                             |

I think this could happen if the agent code "cancels" the stream. This might be implemented as a side effect of cancelling the stream (related to #2) if there are unprocessed UNSET frames and the FIN flag has not been received yet.

NickMRamirez avatar May 28 '20 03:05 NickMRamirez

It looks like the agent should send an ACK frame with the ABORT flag set to tell HAProxy that the agent wants to stop receiving UNSET frames when the payload is fragmented. I suppose the user would determine when to do this, and would need a function that sets this in motion, possibly a delegate that's passed into HandleStream, where some logic is checked to know whether to abort.

It might even be beneficial to leave this unimplemented until someone with a real use case chimes in.

NickMRamirez avatar Jul 10 '20 01:07 NickMRamirez