brpc icon indicating copy to clipboard operation
brpc copied to clipboard

naming_service_thread still falls into loop when it has found ServerNode

Open xiaolin310 opened this issue 3 years ago • 0 comments

Describe the bug (描述bug) I use following channel Init API to resolve full dns hostname.


std::string naming_service_url("http://myhost0.local:8002");
const char *load_balancer_name = "random";
brpc::Channel channel;
if (0 != channel.Init(naming_service_url.c_str(), load_balancer_name, nullptr) )
{
   xxxxxx
}

Another two hosts called myhost1.local, myhost2.local , use above API to init brpc channel. But got following logs,

I0923 09:32:26.908915    29 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:202] brpc::policy::DomainNamingService("myhost0.local:8002"): added 1
W0923 09:32:30.874791    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:32:35.877102    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:32:40.879414    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:32:45.881746    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:32:50.884365    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:32:55.886679    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:33:00.889066    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:33:05.891879    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear
W0923 09:33:10.894347    54 /data/workspace/brpc/src/brpc/details/naming_service_thread.cpp:305] `http://myhost0.local:8002' is empty! RPC over the channel will fail until servers appear

It seems that the other two hosts has resolved the host, but still print empty cyclically. There are also other three port served on hostmyhost0.local named 8000, 8001, 8003, but those are resolved well since there is nothing to print cyclically as above. By the way, the dns name myhost0.local:8002 could be resolved by command shell (nslookup or telnet) in terminal on the other two hosts.

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本) OS: ubuntu 20.04 Compiler: gcc brpc: master d0b71ffc34b73cbec39cd9773b01137f85b4ffde protobuf: 3.6.1

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

xiaolin310 avatar Sep 23 '22 11:09 xiaolin310