Skip to content

Fix #267, enforce the routing socket-error limit - #268

Open
sylvesterkaczmarek wants to merge 1 commit into
nasa:devfrom
sylvesterkaczmarek:fix-267-routing-socket-retry-limit
Open

sylvesterkaczmarek wants to merge 1 commit into
nasa:devfrom
sylvesterkaczmarek:fix-267-routing-socket-retry-limit

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Describe the contribution

Fixes #267.

Remove the unconditional inner receive loop from RoutingService.run, so the existing cumulative five-error condition is evaluated after every receive attempt. Previously persistent socket errors incremented the counter inside while True indefinitely and never reached the outer limit.

The existing one-second delay after each error, short-packet filtering, host discovery, packet topics, forwarding payloads, and exception propagation are preserved. This is a retry-exhaustion fix, not a redesign of stop() or blocked-receive shutdown behavior.

Testing performed

Added seven standard-library unittest methods that use the real RoutingService/QThread object and Qt signal with isolated UDP/publisher boundaries. One test receives an actual datagram through an ephemeral loopback UDP port and then uses real socket timeouts. Tests call run synchronously and replace the error delay, so they do not depend on wall-clock retry sleeps or a GUI event loop.

  • Final new tests against unchanged dev in a separate worktree: 5 failed, 2 passed. Extra reads terminate with assertions rather than letting the old loop hang the test runner.
  • QT_QPA_PLATFORM=offscreen python -m unittest discover -s tests -v: 7 passed.
  • QT_QPA_PLATFORM=offscreen python -m pytest tests -q --cov=RoutingService --cov-report=term-missing: 7 passed, covering 55/55 RoutingService statements.
  • Checks cover repeated/interspersed errors, ignored short packets, multiple host names and packet topics, bind failures, non-socket failures, and loopback reception.
  • Ruff E4,E7,E9,F and formatting checks on the new test file, Python compilation, and git diff --check: passed.

Expected behavior changes

The routing loop returns after its fifth cumulative socket error instead of retrying indefinitely. Successful packets do not reset that existing counter. Socket bind failures and non-socket exceptions continue to propagate. No public API, port assignment, telemetry format, dependency, or workflow changes.

Systems tested on

macOS with Python 3.12.11, PyQt5 5.15.11 and pyzmq 27.2.0, based on dev at 9fb1174cc118bf0a31453401adf052e448617e84. No flight hardware, complete cFS runtime, threaded GUI lifecycle, external telemetry source, or live ZeroMQ subscriber was tested. Upstream static-analysis/build workflows have not been run locally; their results remain subject to maintainer CI.

Third party code

No third-party source added.

Contributor information

Sylvester Kaczmarek (sylvesterkaczmarek), Personal.

Contributor licence agreement completion has not been verified; this PR does not assert that the CLA requirement has been met.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RoutingService never exits after its five socket-error limit

2 participants