Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Patrol thread hangs on a Reolink HTTP call without timeout, engine then sleeps all day as "night"

オープン
#422 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
api, backend

調査の方向性

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.post in reolink.py move_camera that has no timeout. ss shows 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_status reports patrol_running: false and start_patrol returns already_running without spawning a new thread. The engine logs "Patrol restarted" but nothing moves.
  • latest_image for that camera keeps serving the last stored frames, which are night IR images (max(R-G) == 0).
  • SystemController sets is_day from 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

  1. Add timeout= to every requests.post in reolink.py (root cause). Same check for the other adapters.
  2. start_patrol: if the existing thread is alive but its stop flag is set, treat it as dead and start a new one.
  3. is_day should not depend on a single stale frame. Use the fresh recheck capture, or require all cameras to report night.
  4. core.py:273 stops the patrol only when patrol_running is already false. Condition is inverted.
  5. latest_image returns images with no age. Store a timestamp with each frame in last_images and return 204 when the image is older than a max_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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pyronear/pyro-engine のほかの issue

pyronear/pyro-engine の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。