Skip to content

Stabilize python-can filter reconfiguration under active RX polling#380

Closed
Copilot wants to merge 7 commits intov2from
copilot/fix-flaky-pythoncan-test
Closed

Stabilize python-can filter reconfiguration under active RX polling#380
Copilot wants to merge 7 commits intov2from
copilot/fix-flaky-pythoncan-test

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 11, 2026

The python-can test suite was flaky because ThreadSafeBus control operations could block behind the background recv() loop, making filter changes and teardown timing-dependent. This change narrows that race in the adapter and adds regression coverage around the affected path.

  • Adapter synchronization

    • Pause the PythonCAN RX thread briefly before bus-level control operations that compete with recv().
    • Apply the same coordination for filter reconfiguration and shutdown.
    • Emit a clearer warning if pause acknowledgment is not observed in time.
  • Regression coverage

    • Add a targeted test for filter reconfiguration while RX polling is active.
    • Verify the test exercises live polling rather than an idle interface.
  • Behavioral impact

    • No wire-format or transport API changes.
    • Scope is limited to internal coordination around python-can bus control calls.
def filter(self, filters: Iterable[Filter]) -> None:
    self._raise_if_closed()
    ...
    self._pause_rx_thread()
    try:
        self._bus.set_filters(can_filters)
    finally:
        self._resume_rx_thread()

Copilot AI and others added 7 commits April 10, 2026 21:51
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
Agent-Logs-Url: https://github.com/OpenCyphal/pycyphal/sessions/a1b0e29f-d01c-47e8-b492-b104c243c9b1

Co-authored-by: pavel-kirienko <3298404+pavel-kirienko@users.noreply.github.com>
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.

2 participants