Closed
[Bug-Report|缺陷反馈]: TSD 模块日志级别配置错误地使用环境变量作为正则 #1346
pantongAdd on  18 days agoClosed at  17 days ago
pantong
pantong
18 days ago Create

Describe the current behavior / 问题描述 (Mandatory / 必填)

ProcessModeManager::GetLogLevel() 调用 ValidateStr(envModuleLogLevel.c_str(), envModuleLogLevel.c_str()),将 ASCEND_MODULE_LOG_LEVEL 的配置内容同时作为输入和正则表达式。

这不是有效的模块配置校验。配置中含有正则特殊字符时,可能导致整个配置被跳过,连带影响其他有效模块。例如 OTHER=[1]:CCECPU=0:AICPU=3 会导致 CCECPU 和 AICPU 的合法级别均未生效。

Environment / 环境信息 (Mandatory / 必填)

  • Runtime master 基线:94a7659c350e223f8979e4cc74f3bed51164eb5c。
  • Linux,TSD host 侧 ProcessModeManager;使用 tsd_client_utest 和环境变量接口桩复现,不依赖 NPU 硬件。

Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)

  1. 通过 mmSysGetEnv 桩返回模块配置 OTHER=[1]:CCECPU=0:AICPU=3。
  2. 构造 ProcessModeManager,触发 GetLogLevel()。
  3. 检查共享上下文中的 ccecpuLogLevel 和 aicpuLogLevel,修复前均为空。

Describe the expected behavior / 预期结果 (Mandatory / 必填)

使用现有模块解析器逐项解析配置,忽略无效项,保留有效模块项。上述输入应得到 CCECPU 级别 0、AICPU 级别 3;CCECPU=1:AICPU=1 等常规配置继续生效。

对相同回归用例 ProcessModeManagerTest.GetLogLevel_ModuleLevelsContainRegexCharacters_ParsesValidEntries 进行前后对照:

Before: expected ccecpuLogLevel="0", actual=""; expected aicpuLogLevel="3", actual="". FAILED, exit 1.
After: PASSED, exit 0.
ProcessModeManagerTest.*: 30 passed, 0 failed.

Special notes for this issue/备注 (Optional / 选填)

全局日志级别的 logPattern 只接受单个 0-4,不能用于 MODULE=LEVEL 模块配置。修复移除错误的自匹配正则,复用已有的模块名和级别解析逻辑。

likedislike
pantong
pantong
18 days ago Comments:

/assign

likedislike
CANN-robotCANN-robotCollaborators
18 days ago Assign pan-tong as responsible person
pantongpantong
18 days ago Associated pull request
ykl999
ykl999Collaborators
17 days ago Comments:

TSD 模块日志级别配置错误地使用环境变量作为正则问题已修复,pr关闭处理

likedislike
ykl999ykl999Collaborators
17 days ago changed custom state from 待办的 to 已解决
ykl999ykl999Collaborators
17 days ago Close issue
CANN-robotCANN-robotCollaborators
17 days ago Added label: resolved