Files
ykxmz/_build/_cmsg_211.txt
T
xmz7891 c5fa4eb517 2.1.1:修一个会让网站整个挂掉的死锁(「网站容易挂」的真因)
2.1.0 的服务端包里带着这个死锁,所以要单独发一版让部署的人拿到修好的包。

== 死锁 ==

    lanremote-nettune.service   Before=lanremote-tunnel.service
    net-tune.sh 第 4 步         systemctl restart lanremote-tunnel

  nettune 在**自己还没结束**的时候去 restart 一个"必须等自己结束
  才能启动"的服务 -> systemd 判定顺序冲突 -> restart 永不返回
  -> nettune 卡在 activating -> 隧道被 Before= 挡着起不来 -> 公网 530。

  设备上实测卡了 9 分半(CGroup 里能看到 net-tune.sh 下面挂着
  一个 etime 09:32 的 systemctl restart lanremote-tunnel)。
  journalctl 里只有 nettune 停在 activating、**一句报错都没有**;
  手动跑 net-tune.sh 却完全正常(那时没有 Before= 约束)。
  是靠这次新加的监测单元抓到的(fails=3 / last_code=530)。

== 改法 ==

  unit 加 Environment=NETTUNE_SERVICE_CALL=1,脚本据此跳过第 4 步。
  第 4 步只在人工重跑时才有意义(改完 MTU/MSS 让已建隧道用上新参数),
  开机时顺序就是调优先、隧道后,不需要它。

  三处都改了:net-tune.sh 认开关;deploy.sh / install.sh 生成的 unit 带上它。

  没选 systemctl restart --no-block:那只是把阻塞变异步,开机时仍然
  做一次无谓重启(隧道刚起来就被停掉),也没解决"不该在开机时重启"。

== 为什么以前没暴露 ==

  设备上那份旧 unit 的 ExecStart 里有 iptables ... || ...,
  systemd 不支持 ||,所以它在第 2 条 ExecStart 就报错退出,
  根本没走到会死锁的那一步。把 unit 换成正确形状之后才露出来。
2026-10-08 19:52:08 +08:00

36 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
2.1.1:修一个会让网站整个挂掉的死锁(「网站容易挂」的真因)
2.1.0 的服务端包里带着这个死锁,所以要单独发一版让部署的人拿到修好的包。
== 死锁 ==
lanremote-nettune.service Before=lanremote-tunnel.service
net-tune.sh 第 4 步 systemctl restart lanremote-tunnel
nettune 在**自己还没结束**的时候去 restart 一个"必须等自己结束
才能启动"的服务 -> systemd 判定顺序冲突 -> restart 永不返回
-> nettune 卡在 activating -> 隧道被 Before= 挡着起不来 -> 公网 530。
设备上实测卡了 9 分半(CGroup 里能看到 net-tune.sh 下面挂着
一个 etime 09:32 的 systemctl restart lanremote-tunnel)。
journalctl 里只有 nettune 停在 activating、**一句报错都没有**;
手动跑 net-tune.sh 却完全正常(那时没有 Before= 约束)。
是靠这次新加的监测单元抓到的(fails=3 / last_code=530)。
== 改法 ==
unit 加 Environment=NETTUNE_SERVICE_CALL=1,脚本据此跳过第 4 步。
第 4 步只在人工重跑时才有意义(改完 MTU/MSS 让已建隧道用上新参数),
开机时顺序就是调优先、隧道后,不需要它。
三处都改了:net-tune.sh 认开关;deploy.sh / install.sh 生成的 unit 带上它。
没选 systemctl restart --no-block:那只是把阻塞变异步,开机时仍然
做一次无谓重启(隧道刚起来就被停掉),也没解决"不该在开机时重启"。
== 为什么以前没暴露 ==
设备上那份旧 unit 的 ExecStart 里有 iptables ... || ...,
systemd 不支持 ||,所以它在第 2 条 ExecStart 就报错退出,
根本没走到会死锁的那一步。把 unit 换成正确形状之后才露出来。