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 换成正确形状之后才露出来。
This commit is contained in:
xmz7891
2026-10-08 19:52:08 +08:00
parent 05d2287fbf
commit c5fa4eb517
15 changed files with 96 additions and 31 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ $d8 = Join-Path $bt "d8.bat"
$work = Join-Path $android "build"
$outDir = Join-Path $root "dist"
$apkName = "ykxmz-watch-2.1.0.apk"
$apkName = "ykxmz-watch-2.1.1.apk"
function Step($text) { Write-Host "`n=== $text ===" -ForegroundColor Cyan }
@@ -65,7 +65,7 @@ $unsigned = Join-Path $work "app-unsigned.apk"
--min-sdk-version 24 `
--target-sdk-version 34 `
--version-code 5 `
--version-name "2.1.0" `
--version-name "2.1.1" `
--auto-add-overlay
if ($LASTEXITCODE -ne 0) { throw "aapt2 link 失败" }