提交 9fb7589f 编写于 作者: H Haojun Liao

fix(os): fix a deadlock.

上级 fb32ffd9
......@@ -1008,7 +1008,7 @@ int32_t taosGetFqdn(char *fqdn) {
// hints.ai_family = AF_INET;
strcpy(fqdn, hostname);
strcpy(fqdn + strlen(hostname), ".local");
#else // __APPLE__
#else // linux
struct addrinfo hints = {0};
struct addrinfo *result = NULL;
hints.ai_flags = AI_CANONNAME;
......@@ -1020,7 +1020,7 @@ int32_t taosGetFqdn(char *fqdn) {
}
strcpy(fqdn, result->ai_canonname);
freeaddrinfo(result);
#endif // __APPLE__
#endif // linux
return 0;
}
......
......@@ -791,8 +791,10 @@ int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t
tjsonAddIntegerToObject(pJson, "clusterId", clusterId);
tjsonAddIntegerToObject(pJson, "startTime", startTime);
taosGetFqdn(tmp);
tjsonAddStringToObject(pJson, "fqdn", tmp);
// Do NOT invoke the taosGetFqdn here.
// this function may be invoked when memory exception occurs,so we should assume that it is running in a memory locked
// environment. The lock operation by taosGetFqdn may cause this program deadlock.
tjsonAddStringToObject(pJson, "fqdn", tsLocalFqdn);
tjsonAddIntegerToObject(pJson, "pid", taosGetPId());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册