Create a GRPC channel from a file descriptor

819 views
Skip to first unread message

Hemendra Rawat

unread,
Nov 6, 2021, 7:17:15 PM11/6/21
to grpc.io
Hi All,

I'm new to using gRPC!

I'm implementing a gRPC server application that supports live reload of the server with the update version. To achieve this I want to create a unix domain socket and create a gRPC channel using the socket's file descriptor. During hot update of server application A with A', I want to transfer the file descriptor of socket from process A to A' over IPC using UNIX ancillary messages SCM_RIGHTS. Is this transfer possible without disturbing the gRPC channel?

I want the clients connection to not break during live reload of server. The client applications already have retries with timeout to account for server downtime. I will really appreciate if someone can advise me as to how to implement this?

Regards,
Hemendra

Ali Hassan

unread,
Nov 7, 2021, 1:32:27 AM11/7/21
to grpc.io
I think we need many tools to solve this problem. Assume that your application already written in GRPC format. 
1. Your application does have grpc channel if not then you have following ways to achieve.
            1. GRPC CLIENT STUB (https://grpc.io/docs/what-is-grpc/core-concepts/)
            2. By using protocol buffer message 
            3. By using protocol buffer message along with language supported concurrency
 2. Whenever you create Grpc channels, you have  file_descriptor object and which again upto you how to transmit information. 
 3. Now you have channels and application already in grpc, application need domain socket which have created or import some libraries.
 4.  During hot update of server application A with A', I want to transfer the file descriptor of socket from process A to A' this line make me confuse but my approach is server application have own process , sockets and each socket have own file descriptor like Docker and Kubernetes. Once you have create own process and you have file descriptor objects against sockets which will be transmit between server process and server which doesn't make any sense and why the grpc channel exist ?  

Ali Hassan

unread,
Nov 7, 2021, 1:33:59 AM11/7/21
to grpc.io
sorry my mistake i question grpc channeling  

Hemendra Rawat

unread,
Nov 7, 2021, 3:45:49 PM11/7/21
to grpc.io
Hi Thanks for answering my question.Here is my interpretation of your answer

1) My server (A) and client (B) side applications both have grpc support.
2  For my server application (that needs to support live reload), I will create network socket and pass the file descriptor of the client to grpc using " grpc:: AddInsecureChannelFromFd(Server* server, int fd); "
3) Now A and B can communicate to each other using gRPC.

Now during hot update server A (linux process) needs to replaced with a new version of server A' (linux process). What's not clear to me is, how to update the channel between:  (B and A)  to  (B and A')  without client B having to reconnect?

Regards,
Hemendra
Reply all
Reply to author
Forward
0 new messages