Skip to content

core: services: ping: Keep port watcher running after unexpected errors - #4051

Draft
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:fix/ping-port-watcher-resilience
Draft

core: services: ping: Keep port watcher running after unexpected errors#4051
joaoantoniocardoso wants to merge 1 commit into
bluerobotics:masterfrom
joaoantoniocardoso:fix/ping-port-watcher-resilience

Conversation

@joaoantoniocardoso

@joaoantoniocardoso joaoantoniocardoso commented Jul 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Catch unexpected errors in the Ping PortWatcher loop so discovery keeps running.
  • Add a regression test that a transient add_ping360 failure does not stop watching.

Follow-up to #4036: that PR fixes the list_ips() KeyError, but any other uncaught exception in the watch loop still permanently kills sensor discovery because sensor_manager() is started with a bare asyncio.create_task.

Test plan

  • pytest core/services/ping/test_portwatcher.py
  • Confirm Ping service continues discovering after SoftAP/uap0 churn on a vehicle

Supersedes #4040 (recreated from fork joaoantoniocardoso/BlueOS-docker instead of same-repo head).

@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: LGTM :shipit:

Wraps the body of PortWatcher.start_watching's while True loop in try/except Exception + logger.exception, so any unexpected error (e.g. transient add_ping360/list_ips failures) no longer permanently kills the sensor-discovery task. Adds a focused regression test (core/services/ping/test_portwatcher.py) that confirms a raised KeyError in add_ping360 does not stop the watch loop, using asyncio.CancelledError (a BaseException on 3.11, so unaffected by except Exception) to break out on the second iteration.

No further comments, nice job 👍

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

@joaoantoniocardoso joaoantoniocardoso added the move-to-stable Needs to be cherry-picked and move to stable label Jul 27, 2026
@joaoantoniocardoso
joaoantoniocardoso marked this pull request as draft July 27, 2026 21:34
@joaoantoniocardoso
joaoantoniocardoso force-pushed the fix/ping-port-watcher-resilience branch from b3d7d9f to d6c8308 Compare July 28, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

move-to-stable Needs to be cherry-picked and move to stable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant