brpc icon indicating copy to clipboard operation
brpc copied to clipboard

revive socket should also re-resolve names

Open BusyJay opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)

It's a common practice to switch the backend server by changing DNS record. However, bRPC only resolve the name once when a channel is initialized, and keep trying the same IP afterwards. So updating DNS record will lead to permanently failure.

Describe the solution you'd like (描述你期望的解决方法)

Instead of saving butil::EndPoint, socket/channel should save the original remote address instead. And during health check, the original remote address should be used.

This is also the behavior of gRPC: https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md

Describe alternatives you've considered (描述你想到的折衷方案)

Without a builtin solution from bRPC, application will need to develop their health check mechanism (again).

Additional context/screenshots (更多上下文/截图)

BusyJay avatar Jun 19 '24 07:06 BusyJay

Use domain name with lb, like channel.Init("http://baidu.com", "rr", &opts). DomainNamingService will periodically query DNS to get the latest IP.

chenBright avatar Jun 19 '24 08:06 chenBright