openconfig / gribi

A gRPC Interface to a Network Element RIB.
Apache License 2.0
57 stars 14 forks source link

Server initiated connection termination #10

Closed rambattu closed 3 years ago

rambattu commented 3 years ago

https://github.com/openconfig/gribi/blob/40372e8b4395934f2ebfd30c39615e42dc383f2c/v1/proto/service/gribi.proto#L108

// If the client redundancy mode is ALL_PRIMARY, but a client // sends election_id, the network element closes the connection // to the client and responds with FAILED_PRECONDITION in // status.proto's code and sets ModifyRPCErrorDetails.reason // to ELECTION_ID_IN_ALL_PRIMARY

When a client makes an invalid request via ModifyRequest message, is the server endpoint supposed to terminate the client connection after sending an error status?

In almost all the gRPC server examples I have looked, the server has only RPC specific context, don't see a mechanism to initiate disconnection of the client. Is there any gRPC example where the server initiates the client termination as well after sending error on the RPC, that would be helpful for reference.

nandanarista commented 3 years ago

https://github.com/openconfig/gribi/blob/40372e8b4395934f2ebfd30c39615e42dc383f2c/v1/proto/service/gribi.proto#L108

// If the client redundancy mode is ALL_PRIMARY, but a client // sends election_id, the network element closes the connection // to the client and responds with FAILED_PRECONDITION in // status.proto's code and sets ModifyRPCErrorDetails.reason // to ELECTION_ID_IN_ALL_PRIMARY

When a client makes an invalid request via ModifyRequest message, is the server endpoint supposed to terminate the client connection after sending an error status?

In almost all the gRPC server examples I have looked, the server has only RPC specific context, don't see a mechanism to initiate disconnection of the client. Is there any gRPC example where the server initiates the client termination as well after sending error on the RPC, that would be helpful for reference.

This is referring to the server's RPC handler returning with an error which will close the stream for that Modify. See the reference server implementation in gribigo.

checkParams creates the errdetails and it is returned in Modify()

Maybe we can reword the text you've quoted to say closes the Modify RPC stream instead ?

rambattu commented 3 years ago

Yes @nandanarista , that will greatly help because the term "connection" can be very confusing.