OneDragon-Anything / OneDragon-Anything/OneDragon-ScriptChainer
[Bug] 启动器目标进程搜索超时固定 30 秒且不可配置,更新耗时较长时被误杀
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 217
- Forks
- 14
- PR merge metrics
- No merged PRs in 30d
Description
问题描述
在“启动器启动”模式下,千机链寻找“启动后实际运行的程序”的超时时间固定为 30 秒,且配置界面/YAML 没有对应可调整项。
当启动器在拉起目标进程前需要先更新代码、检查依赖,或开机后网络较慢时,即使启动器仍在正常运行并持续输出日志,只要目标进程没有在 30 秒内出现,千机链就会判定启动失败、终止启动器并跳过当前脚本。
本例中受影响的是绝区零一条龙普通启动器。相同配置在更新完成后手动运行可以正常启动。
环境
- Windows
- OneDragon ScriptChainer v1.4.0
- 通过 Windows 任务计划程序运行
OneDragon ScriptChainer Runner.exe --chain 01 - 绝区零一条龙启动器 v2.4.7
脱敏后的脚本配置
script_type: external
script_path: <ZZZ_OD_DIR>\OneDragon-Launcher.exe
script_process_name:
- python.exe
- pythonw.exe
game_process_name: ZenlessZoneZero.exe
launcher_mode: true
run_timeout_seconds: 3600
check_done: game_or_script_closed
script_arguments: -o -c
no_log_timeout_seconds: 60
enabled: true
其中“启动后实际运行的程序”使用千机链自带的“一条龙”预设。
复现步骤
- 开启绝区零一条龙启动器的代码自动更新。
- 在千机链中按上述配置使用“启动器启动”模式。
- 让启动器的代码拉取/依赖检查阶段持续超过 30 秒,使
python.exe/pythonw.exe尚未出现。 - 运行脚本链。
实际结果
启动器仍在正常拉取代码并输出进度,但约 30 秒时被千机链判定失败并终止。以下时间改为相对时间并已脱敏:
[T+00s] [脚本] OneDragon 启动器 v2.4.7
[T+01s] [脚本] 拉取远程代码
[T+03s] [脚本] 远程消息: 枚举对象完成
...
[T+28s] [脚本] 拉取对象约 73%
[T+30s] 脚本进程启动失败 <ZZZ_OD_DIR>\OneDragon-Launcher.exe
[T+50s] 如长时间未检测到进程,请检查“启动后实际运行的程序”填写是否正确:python.exe / pythonw.exe
[T+50s] 子进程创建失败 <ZZZ_OD_DIR>\OneDragon-Launcher.exe
该问题在多次定时运行中都稳定发生于启动约 30 秒处;同一配置在代码拉取很快完成、目标进程能在 30 秒内出现时可以启动成功,说明进程名称配置没有填错。
日志
预期结果
- “启动后实际运行的程序”的搜索等待时间可以在每个外部脚本中配置;或
- 只要启动器仍在运行且持续输出日志,就不应在固定 30 秒时直接终止;或
- 至少将等待时间与已有的“运行超时/无日志超时”明确区分并在界面中显示。
源码定位
src/script_chainer/win_exe/script_runner.py 中固定传入 30 秒:
success = pm.open_process(
program=script_path,
args=args_list,
target_process=target_process_infos,
search_timeout=30,
stdout_callback=_make_stdout_callback(display_name, log_notifier, state),
)
src/script_chainer/services/process_manager.py 中,目标进程未找到后会调用 self.kill() 回收启动器:
if target_process is not None:
found = self.search_process(target_process, search_timeout)
if not found:
self.kill()
return found
建议方案
建议新增每脚本配置项,例如:
startup_timeout_seconds: 120
- 默认值可以继续保持 30 秒,以兼容现有行为。
- 在外部程序编辑界面中,仅“启动器启动”模式显示该项。
- 将其传给
ProcessManager.open_process(search_timeout=...)。 - “运行超时”和“无日志超时”目前都无法影响目标进程出现前的这 30 秒,因此不能作为现有替代方案。
临时关闭绝区零一条龙的自动更新可以规避,但会失去启动时自动更新能力,不适合作为通用解决办法。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/script_chainer/win_exe/script_runner.py, where open_process receives the fixed search_timeout=30, then read src/script_chainer/services/process_manager.py to understand how a missing target process triggers cleanup. Trace the external-script configuration and editor paths for adding the launcher-only setting. Done means the timeout is configurable per script, remains distinct from run and no-log timeouts, and the existing launcher behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100