fix(os): fix a deadlock.
This commit is contained in:
parent
fb32ffd960
commit
9fb7589fb5
|
@ -1008,7 +1008,7 @@ int32_t taosGetFqdn(char *fqdn) {
|
||||||
// hints.ai_family = AF_INET;
|
// hints.ai_family = AF_INET;
|
||||||
strcpy(fqdn, hostname);
|
strcpy(fqdn, hostname);
|
||||||
strcpy(fqdn + strlen(hostname), ".local");
|
strcpy(fqdn + strlen(hostname), ".local");
|
||||||
#else // __APPLE__
|
#else // linux
|
||||||
struct addrinfo hints = {0};
|
struct addrinfo hints = {0};
|
||||||
struct addrinfo *result = NULL;
|
struct addrinfo *result = NULL;
|
||||||
hints.ai_flags = AI_CANONNAME;
|
hints.ai_flags = AI_CANONNAME;
|
||||||
|
@ -1020,7 +1020,7 @@ int32_t taosGetFqdn(char *fqdn) {
|
||||||
}
|
}
|
||||||
strcpy(fqdn, result->ai_canonname);
|
strcpy(fqdn, result->ai_canonname);
|
||||||
freeaddrinfo(result);
|
freeaddrinfo(result);
|
||||||
#endif // __APPLE__
|
#endif // linux
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -791,8 +791,10 @@ int32_t taosGenCrashJsonMsg(int signum, char** pMsg, int64_t clusterId, int64_t
|
||||||
tjsonAddIntegerToObject(pJson, "clusterId", clusterId);
|
tjsonAddIntegerToObject(pJson, "clusterId", clusterId);
|
||||||
tjsonAddIntegerToObject(pJson, "startTime", startTime);
|
tjsonAddIntegerToObject(pJson, "startTime", startTime);
|
||||||
|
|
||||||
taosGetFqdn(tmp);
|
// Do NOT invoke the taosGetFqdn here.
|
||||||
tjsonAddStringToObject(pJson, "fqdn", tmp);
|
// 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());
|
tjsonAddIntegerToObject(pJson, "pid", taosGetPId());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue