[Bug]: await_lock masks exceptions as FileLockError; minion job_queue requeues forever ("Failed to acquire job_queue lock" log flood)
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 salt.utils.files.await_lock 开始,跟踪其围绕 with 代码体的异常处理,然后检查 _handle_decoded_payload 和 _process_process_queue_async_impl。确认代码体中的异常仍能与获取锁失败区分开来,确认 FileLockError 日志包含该异常,并确认反复失败的队列任务最终会停止重新入队,并向 master 返回错误。
由索引模型根据 Issue 内容生成。
描述
What happened?
On 3007.13 two minions got stuck in an infinite requeue loop, logging ~180 lines/s of
[salt.minion :1960][WARNING ] Failed to acquire job_queue lock for jid 2026..., queuing anyway.
for a week, until /var/log/salt/minion reached 9 GB and filled /var. 59 stale jids cycled every 0.3 s. No job_queue.lock file existed, fds were 45/8192, plenty of RAM. The loop started 9 s after a Timeout encountered while sending ... _return request.
Root cause, two defects that combine:
-
salt.utils.files.await_lockhides the real exception. Theyieldis inside the outertry, whoseexcept Exceptionre-raises everything asFileLockError("Error encountered obtaining file lock ..."). Any exception raised by theasync with await_lock(...)body is reported as a lock failure and its traceback is lost. In 3007.13 the body included_invoke_execution()and the proc-file write, so a job-start failure became "Failed to acquire job_queue lock". 3007.14 moved_invoke_executionout of the lock, butawait_lockitself is unchanged in 3008.x, and the minion'sexcept FileLockErrorhandler still logs without the exception. -
The disk job queue has no exit.
_process_process_queue_async_implresubmits everyqueued_*.pfile every 0.3 s (0.2 s in 3008.x) with no retry counter, max age or backoff. A job that fails deterministically at start is requeued forever.
Workaround used: stop minion, move cachedir/job_queue aside, truncate log, start.
Expected
await_lockshould not convert exceptions from thewithbody intoFileLockError(re-raise them unchanged, keep the wrapping for the lock-acquire path only)._handle_decoded_payload'sexcept FileLockErrorshould log the exception (exc_info=True).- Queued jobs need a retry limit and/or max age; after that the job is dropped with an error and a return to the master.
Type of salt install
onedir
Major version
3007 (3007.13); defect 1 and 2 still present in 3008.2 / master
What supported OS are you seeing the problem on?
Ubuntu
salt --versions-report output
Salt Version:
Salt: 3007.13
Python: /opt/saltstack/salt/bin/python3.10 (onedir)
OS: Ubuntu, cPanel hosts
- 主要语言
- Python
- 星标
- 15.8k
- 派生
- 5.6k
- 平均合并
- 5 天 9 小时
- 30 天内合并 PR
- 99
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
saltstack/salt 的其他 Issue
-
[Bug]: Scheduled returns scan all accepted minion keys causing extreme load可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 76/100
saltstack/salt#70789 · 1 条评论 ·
维护者通常 3 天内回复
-
[Bug]: pip.installed with upgrade=True upgrades a package but returns an empty changes dictionary可能已有人在做 @ITJamie 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
bug needs-triage
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 3 天内回复
-
[Bug]: Minion with file_client: local crashes on connect: 'AsyncPillar' object has no attribute 'aclose'可能已有人在做 @shawnrruss 于 9 天前认领。 未关闭bug needs-triage
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
[Bug]: mine.update clear=True raises UnboundLocalError on the master and stores nothing可能已有人在做 @cestercian 于 11 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 74/100
saltstack/salt#70622 · 1 条评论 ·
维护者通常 3 天内回复
相似的 Issue
-
AI bug
难度 2/5 1-3 小时 新手友好度 68/100
AUTO-MAS-Project/AUTO-MAS#1960 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
btclib-org/btclib-wallet#872 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 87/100
btclib-org/btclib#3093 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 85/100
patrickballard/wheelgap#269 ·