diff --git a/CHANGELOG.md b/CHANGELOG.md index 75b014b3bf..abd700992f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Please mark all change in change log and use the issue from GitHub - \#2381 Upgrade FAISS to 1.6.3 - \#2441 Improve Knowhere code coverage - \#2466 optimize k-selection implemention of faiss gpu version +- \#2495 Add creating lock file failure reason. ## Task diff --git a/core/src/server/init/InstanceLockCheck.cpp b/core/src/server/init/InstanceLockCheck.cpp index 293bb70ac0..0fca2fd99a 100644 --- a/core/src/server/init/InstanceLockCheck.cpp +++ b/core/src/server/init/InstanceLockCheck.cpp @@ -14,6 +14,7 @@ #include #include +#include #include namespace milvus { @@ -29,7 +30,7 @@ InstanceLockCheck::Check(const std::string& path) { // Not using locking for read-only lock file msg += "Lock file is read-only."; } - msg += "Could not open lock file."; + msg += "Could not open file: " + lock_path + ", " + strerror(errno); return Status(SERVER_UNEXPECTED_ERROR, msg); } @@ -41,15 +42,16 @@ InstanceLockCheck::Check(const std::string& path) { fl.l_start = 0; fl.l_len = 0; if (fcntl(fd, F_SETLK, &fl) == -1) { - std::string msg; + std::string msg = "Can't lock file: " + lock_path + ", due to "; if (errno == EACCES || errno == EAGAIN) { - msg += "Permission denied. "; + msg += "permission denied. "; } else if (errno == ENOLCK) { // Not using locking for nfs mounted lock file - msg += "Using nfs. "; + msg += "using nfs. "; + } else { + msg += std::string(strerror(errno)) + ". "; } close(fd); - msg += "Could not get lock."; return Status(SERVER_UNEXPECTED_ERROR, msg); }