diff --git a/source/os/src/osSocket.c b/source/os/src/osSocket.c index 7d2c8aa4e5454c4c9cf22fe0f7bdb40ab90690ac..2b2a0daf7b4d0bf7e69552c442a047bd9f32e0a5 100644 --- a/source/os/src/osSocket.c +++ b/source/os/src/osSocket.c @@ -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; } diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index a3d3c399abcd6040cf042dec045024549e2d3179..e1cf01aa2f94f5705784e7609660f955ababd76c 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -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());