소스 검색

Fix logging deadlock in levelToSystemdPriority()

The levelToSystemdPriority() function was calling isRunningUnderSystemd()
which tried to acquire the same mutex that was already locked in the log()
method, causing a deadlock and preventing any log output.

Fixed by directly checking the m_isRunningUnderSystemd member variable
instead of calling isRunningUnderSystemd() to avoid the recursive mutex
lock.

This resolves the issue where no log output appeared when running the
server in terminal (not systemd) even with the --verbose flag.
Fszontagh 3 달 전
부모
커밋
eea90f52ce
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3 1
      src/logger.cpp

+ 3 - 1
src/logger.cpp

@@ -96,7 +96,9 @@ std::string Logger::typeToString(LoggerType type) {
 
 std::string Logger::levelToSystemdPriority(LogLevel level) {
     // Only include priority markers when running under systemd
-    if (!isRunningUnderSystemd()) {
+    // Note: Don't call isRunningUnderSystemd() here to avoid deadlock
+    // since this method is called from within the log() method which already holds the mutex
+    if (!m_isRunningUnderSystemd) {
         return "";
     }