From 7c00ed2e47a83fdcff11032aaf1c32d2f2e65231 Mon Sep 17 00:00:00 2001 From: hz4th_coder Date: Fri, 11 Sep 2026 23:37:24 +0800 Subject: [PATCH] =?UTF-8?q?v1.9.3=20=E4=BF=AE=E5=A4=8D=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E9=9D=99=E9=BB=98=E6=8C=82=E6=8E=89:=20=E5=85=B3debug=20reload?= =?UTF-8?q?er=E6=94=B9=E5=8D=95=E8=BF=9B=E7=A8=8B=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=20+=20setsid=E5=90=AF=E5=8A=A8=E8=84=B1?= =?UTF-8?q?=E7=A6=BB=E4=BC=9A=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: ①Flask debug reloader 主进程在 worker 意外退出后不会自动拉起, 导致主进程存活但端口无监听, 无任何日志报错(静默挂); ②openclaw exec 会话结束时清理进程组, nohup 启动的服务随会话结束被杀 修复: debug=False + use_reloader=False(单进程, threaded), 启动命令改 setsid nohup ... < /dev/null 脱离会话进程组 启动: cd works/web-capture-api && setsid nohup /home/hz1/miniconda3/envs/openclaw/bin/python3 app.py > logs/app.log 2>&1 < /dev/null & disown --- app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index de44f58..6f450aa 100644 --- a/app.py +++ b/app.py @@ -1777,4 +1777,6 @@ if __name__ == '__main__': print(" playwright: pip install playwright && playwright install chromium") print("\n🚀 Server running on http://0.0.0.0:16025") - app.run(host='0.0.0.0', port=16025, debug=True) \ No newline at end of file + # 生产模式:不启用 debug reloader(reloader 主进程在 worker 意外退出后不会自动拉起, + # 曾导致服务静默挂掉),改代码后需手动重启:kill 进程后 nohup 重新启动 + app.run(host='0.0.0.0', port=16025, debug=False, use_reloader=False, threaded=True) \ No newline at end of file