Patrol thread hangs on a Reolink HTTP call without timeout, engine then sleeps all day as "night"
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start in reolink.py at move_camera and inspect every requests.post call, then trace start_patrol, latest_image, and the is_day logic in core.py around lines 204 and 273. Reproduce the stuck-thread and stale-frame paths if possible. Done means timed-out HTTP calls cannot hang patrols, stopped threads can restart, patrol state uses fresh image data, and stale images are rejected.
索引モデルが issue の本文から書いたものです。
説明
This issue is part of the epic pyronear/roadmap#16 (Engine robustness).
Observed on bellefosse (pyro-engine 1.0.18, two Reolink PTZ cameras) on 2026-09-21.
What happened
- At 02:50 UTC the patrol thread of camera 192.168.1.12 stopped logging after "Moving to pose 2". The thread is still alive, blocked on a
requests.postinreolink.pymove_camerathat has no timeout.ssshows an ESTAB socket to the camera on port 443 held by uvicorn. The camera itself answers fine (ping, HTTPS, focus finder). - Because the thread is alive but its stop flag is set,
patrol_statusreportspatrol_running: falseandstart_patrolreturnsalready_runningwithout spawning a new thread. The engine logs "Patrol restarted" but nothing moves. latest_imagefor that camera keeps serving the last stored frames, which are night IR images (max(R-G) == 0).SystemControllersetsis_dayfrom the last frame of the loop (core.py:204), which is that camera's last pose. Every hour: recheck on camera 1 says day, one loop runs, last frame is the stale IR image, "Nighttime detected", sleep 1 h. The site has been blind since 04:56 UTC.
Fixes
- Add
timeout=to everyrequests.postinreolink.py(root cause). Same check for the other adapters. start_patrol: if the existing thread is alive but its stop flag is set, treat it as dead and start a new one.is_dayshould not depend on a single stale frame. Use the fresh recheck capture, or require all cameras to report night.- core.py:273 stops the patrol only when
patrol_runningis already false. Condition is inverted. latest_imagereturns images with no age. Store a timestamp with each frame inlast_imagesand return 204 when the image is older than amax_age(default 5 min, query param). On the engine side the frame is already skipped when the response is empty. This alone would have prevented the false night detection: the stale IR frame would never have reached the engine.
Workaround
docker restart pyro-camera-api kills the zombie thread. Engine resumes at the next hourly recheck.
Not related to PR 419 (engine heartbeat deadlock), but same class of bug: HTTP call without timeout freezing a thread forever.
- 主要言語
- Python
- スター
- 20
- フォーク
- 9
- 平均マージ
- 8日 19時間
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
pyronear/pyro-engine のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
pyronear/pyro-engine#368 ·
メンテナーはふだん 2 日以内に返信
-
topic: documentation
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
pyronear/pyro-engine#455 ·
メンテナーはふだん 2 日以内に返信
-
type: new feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
pyronear/pyro-engine#454 ·
メンテナーはふだん 2 日以内に返信
-
type: new feature
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
pyronear/pyro-engine#453 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
pyronear/pyro-engine#452 ·
メンテナーはふだん 2 日以内に返信
pyronear/pyro-engine の issue をすべて見る
似ている issue
-
Project submission:オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
slavakurilyak/awesome-ai-agents#845 ·
メンテナーはふだん 1 日以内に返信
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directory対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdifficulty:2 enhancement good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
MakazhanAlpamys/Soup#2178 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
scverse/rapids-singlecell#854 ·
メンテナーはふだん 1 日以内に返信
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGL対応中かも @ninglinLiu が今日担当しました。 オープンarea:frontend backend:slang bug direction:input
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=False対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 13 日以内に返信