devicecode hangs in a non-yielding busy loop after uplink/modem churn: no telemetry, UI or daily reboot for 6 days (bigbox-ss, v0.12.0-ocw4)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- linux, lua
- 領域
- backend, observability
調査の方向性
Start by reading the uplink and modem state paths named in the issue: report_active_uplink_change, backhaul publishing, WAN runtime and mwan3 observation handling, schedule_speedtest_retry, and GSM state handling related to #394. Compare their loops with the busy loop fixed in #343, then try the WAN loss and modem conditions on the rig while monitoring voluntary context switches and UI responsiveness. Done means locating and fixing the non-yielding loop and adding a way to detect or diagnose a future hang; the issue does not identify the responsible function.
索引モデルが issue の本文から書いたものです。
説明
Summary
On BB7DIW52DERCCH (bigbox-ss, bigbox-ss-v0.12.0-ocw4-2026-11-18T112303-v22.03.7, devicecode-lua c835c62), devicecode froze at 18:14:59 UTC on 24 Nov 2026 and was still frozen on 30 Nov 12:50 UTC.
The process is alive but spins one CPU core and never yields, so every service inside it is starved:
- no cloud telemetry;
- the local UI doesn't answer;
- no daily reboot;
- no modem or uplink management.
procd doesn't respawn it, because it never exits. mwan3 and swupdate/suricatta run separately, so the box still routes traffic and still polls HawkBit every minute.
Timeline (UTC)
- 24 Nov 17:33–17:41: HawkBit installs v0.11.3, then ocw4 again (a deliberate rollback test). Boot at 17:40:16.
- 17:41–18:14: normal telemetry. The WAN is unplugged by accident, and traffic moves to modem_primary.
- 18:11:40 and 18:13:40:
modem.2(secondary, never registers) flipssearching→enabled(see #394). - 18:12:24:
net.active_uplink=last_resort. - 18:12:29:
net.active_uplink=modem_primary. - 18:12–18:14: modem.1 signal weakening: bars 4 → 2, RSRP −114 dBm, SNR −0.2.
- 18:14:59: the last cloud message (modem.1 metrics tick). Nothing from devicecode after this.
- 25 Nov 05:00 onwards: no daily reboot. Uptime on 30 Nov was 5 days 19 h.
- 30 Nov: the WAN is back (default route via
vl-wan), HawkBit polls every minute, and devicecode is still silent.
On-box evidence (30 Nov 12:42–12:50 UTC, read-only)
- The process is running, not crashed.
luajit main.luais PID 6718 in stateR. It started 19 s after boot./tmp/devicecode-crash.jsonshows{"crashes":0,"running":true,...}. - It's spinning.
- CPU time is utime 486,549 s over about 500,500 s of uptime.
- A 5-second sample used 499 of 500 ticks of one core, steady at about 26% of the 4-core Pi.
- Load average holds at 1.07.
- It never yields.
voluntary_ctxt_switchesstayed at 27332 → 27332 over 10 s.nonvoluntary_ctxt_switcheswent 15650445 → 15650768.- So it never blocks in epoll or a sleep; it's a pure user-space loop.
- The local UI is starved.
- It still listens on
0.0.0.0:80, butwget -T 8 http://127.0.0.1/times out. - The accepted connections sit in
CLOSE_WAITwith Recv-Q 1, never read.
- It still listens on
- No cloud connection. devicecode has no outbound TCP sockets, only UDP to the local DNS.
- Its child processes are still alive:
mmcli -m …/Modem/0 -w,mmcli -m …/Modem/2 -w,mmcli -M, andqmicli --uim-monitor-slot-statuson cdc-wdm0 and cdc-wdm1. - Nothing in the logs. devicecode wrote nothing to syslog (procd stdout/stderr → logd). The ring buffer only goes back to 30 Nov 10:24 and holds ModemManager, swupdate and dnsmasq lines.
- No tools to inspect it.
strace,gdbandperfaren't on the image, so the looping function couldn't be found from outside.
Impact
-
A box in this state silently loses:
- telemetry;
- modem recovery and uplink policy;
- the daily reboot;
- the local UI.
It looks healthy in HawkBit and stays this way until someone power-cycles it.
-
The trigger seems to be ordinary field conditions: WAN loss, a weak primary signal, a secondary SIM that never registers, and a brief
last_resort. Many boxes see those often. -
The v0.11.3 → ocw4 canary boxes haven't hit it yet. That doesn't show the trigger is rare.
Likely area (not confirmed)
A loop that never yields, in a fiber that runs on uplink or modem state changes. Candidates:
- the net service backhaul and active-uplink recompute (
report_active_uplink_changeand the code that publishes backhaul); - the WAN runtime and mwan3 observation handling;
- the speedtest retry scheduling (
schedule_speedtest_retry); - the gsm state handling for a modem flipping between
searchingandenabled(#394).
The modem-state-monitor busy loop fixed in #343 was the same kind of bug.
Asks
- Find the loop. Review the code paths above for loops that never yield, and reproduce on the rig:
- unplug the WAN while the secondary SIM can't register;
- flap the primary signal, or run a forced ifdown;
- watch devicecode's voluntary context switches and whether the UI answers.
- Add hang detection, not just crash respawn. For example:
- a watchdog fiber whose heartbeat is checked from outside devicecode (procd/ubus or a hardware watchdog);
- or a LuaJIT instruction-count hook in debug builds that logs a traceback when a fiber runs too long without yielding.
- Make the next occurrence diagnosable. Ship a way to dump fiber or stack state on a signal that doesn't depend on the scheduler, or log key service events to syslog in prod.
Box state: BB7DIW52DERCCH is left in the hung state for further inspection. Recover it with /etc/init.d/devicecode restart.
- 主要言語
- Lua
- スター
- 1
- フォーク
- 0
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 24
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jangala-dev/devicecode-lua のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
jangala-dev/devicecode-lua#441 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
jangala-dev/devicecode-lua#440 ·
メンテナーはふだん 1 日以内に返信
-
Serve local UI static files gzip-compressed対応中かも @lePereT が 2 日前に担当しました。 オープンenhancement
jangala-dev/devicecode-lua#437 · 担当者 2 名 ·
メンテナーはふだん 1 日以内に返信
-
Report browser and OS versions with local UI visits対応中かも @lePereT が 2 日前に担当しました。 オープンenhancement
jangala-dev/devicecode-lua#436 · 担当者 2 名 ·
メンテナーはふだん 1 日以内に返信
-
net: active_uplink stuck on modem_secondary for ~20 h while modem_primary carries the traffic (v0.12.0-ocw4)対応中かも @rslater-cs が 3 日前に担当しました。 オープン
jangala-dev/devicecode-lua#431 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
jangala-dev/devicecode-lua の issue をすべて見る
似ている issue
-
follow-up needs-review
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ksysoev/duet.nvim#310 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Jaliborc/PetTracker#509 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
bug discord triage
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
fitzforge/polestar#5203 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信