Skip to content

fix: raise TimeoutError on ZMQ retry exhaustion instead of returning None#466

Open
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
GaneshPatil7517:fix/issue-393-zmq-retry-none-crash
Open

fix: raise TimeoutError on ZMQ retry exhaustion instead of returning None#466
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
GaneshPatil7517:fix/issue-393-zmq-retry-none-crash

Conversation

@GaneshPatil7517
Copy link

Summary

Fixes #393recv_json_with_retry() returned None after 5 failed attempts, which propagated
to user control loops causing TypeError crashes at runtime.

Changes

concore_base.py

  • recv_json_with_retry() — now raises TimeoutError instead of returning None
  • send_json_with_retry() — now raises TimeoutError instead of silently returning None
  • read() — added explicit except TimeoutError handler that returns default_return_val
  • write() — added explicit except TimeoutError handler that logs the error without crashing

tests/test_concore.py

  • Added TestZMQRetryExhaustion class with 4 tests:
    • recv_json_with_retry raises TimeoutError after 5 failed attempts
    • send_json_with_retry raises TimeoutError after 5 failed attempts
    • read() returns default_return_val on ZMQ timeout (not None)
    • write() handles send timeout gracefully without crashing

tests/test_concoredocker.py

  • Added TestZMQRetryExhaustion class with 2 tests covering the same timeout paths via concoredocker

How it works

Previously, exhausted retries returned None silently — no exception was raised, so the existing
except blocks in read()/write() never triggered. Now TimeoutError is raised, which is caught
by the new explicit handler (and would also be caught by the existing except Exception fallback).
This ensures read() always returns a usable value (default_return_val) and write() never
crashes the caller.

Test results

All 60 tests pass (test_concore.py + test_concoredocker.py + test_protocol_conformance.py).

Fixes #393

…None (ControlCore-Project#393)

- recv_json_with_retry() now raises TimeoutError after 5 failed attempts
  instead of returning None
- send_json_with_retry() now raises TimeoutError after 5 failed attempts
  instead of silently returning None
- read() catches TimeoutError explicitly and returns default_return_val
- write() catches TimeoutError explicitly and logs error without crashing
- Added new test class TestZMQRetryExhaustion in test_concore.py with 4 tests
- Added new test class TestZMQRetryExhaustion in test_concoredocker.py with 2 tests

Closes ControlCore-Project#393
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.

1 participant