diff --git a/run.sh b/run.sh index 2109b2f4ef..743eb2b961 100755 --- a/run.sh +++ b/run.sh @@ -27,7 +27,7 @@ export REPORT_DIR="$ROOT/test_report" export THIRDPARTY_ROOT=$ROOT/thirdparty export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64/server:${BUILD_LATEST_DIR}/output/lib:${THIRDPARTY_ROOT}/output/lib:${LD_LIBRARY_PATH} # Disable AddressSanitizerOneDefinitionRuleViolation, see https://github.com/google/sanitizers/issues/1017 for details. -export ASAN_OPTIONS=detect_odr_violation=0 +export ASAN_OPTIONS=detect_odr_violation=0:abort_on_error=1:disable_coredump=0:unmap_shadow_on_exit=1 # See https://github.com/gperftools/gperftools/wiki/gperftools'-stacktrace-capturing-methods-and-their-issues. # Now we choose libgcc, because of https://github.com/apache/incubator-pegasus/issues/1685. export TCMALLOC_STACKTRACE_METHOD=libgcc # Can be generic_fp, generic_fp_unsafe, libunwind or libgcc diff --git a/src/runtime/rpc/rpc_host_port.cpp b/src/runtime/rpc/rpc_host_port.cpp index 7abc76d365..558803d0a6 100644 --- a/src/runtime/rpc/rpc_host_port.cpp +++ b/src/runtime/rpc/rpc_host_port.cpp @@ -72,27 +72,29 @@ host_port::host_port(std::string host, uint16_t port) bool host_port::from_string(const std::string s) { - std::string ip_port = s; - auto pos = ip_port.find_last_of(':'); + auto pos = s.find_last_of(':'); if (pos == std::string::npos) { return false; } - std::string host = ip_port.substr(0, pos); - std::string port = ip_port.substr(pos + 1); + _host = s.substr(0, pos); + std::string port = s.substr(pos + 1); - // check port - unsigned int port_num; - if (!internal::buf2unsigned(port, port_num) || port_num > UINT16_MAX) { + if (!internal::buf2unsigned(port, _port) || _port > UINT16_MAX) { return false; } - if (rpc_address::ipv4_from_host(host.c_str()) == 0) { + struct addrinfo hints; + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + AddrInfo result; + auto err_code = GetAddrInfo(_host, hints, &result); + + if (dsn_unlikely(!err_code.ok())) { return false; } _type = HOST_TYPE_IPV4; - _host = host; - _port = port_num; return true; }