fix: raise TimeoutError on ZMQ retry exhaustion instead of returning None#466
Open
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
Open
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #393 —
recv_json_with_retry()returnedNoneafter 5 failed attempts, which propagatedto user control loops causing
TypeErrorcrashes at runtime.Changes
concore_base.pyrecv_json_with_retry()— now raisesTimeoutErrorinstead of returningNonesend_json_with_retry()— now raisesTimeoutErrorinstead of silently returningNoneread()— added explicitexcept TimeoutErrorhandler that returnsdefault_return_valwrite()— added explicitexcept TimeoutErrorhandler that logs the error without crashingtests/test_concore.pyTestZMQRetryExhaustionclass with 4 tests:recv_json_with_retryraisesTimeoutErrorafter 5 failed attemptssend_json_with_retryraisesTimeoutErrorafter 5 failed attemptsread()returnsdefault_return_valon ZMQ timeout (notNone)write()handles send timeout gracefully without crashingtests/test_concoredocker.pyTestZMQRetryExhaustionclass with 2 tests covering the same timeout paths viaconcoredockerHow it works
Previously, exhausted retries returned
Nonesilently — no exception was raised, so the existingexceptblocks inread()/write()never triggered. NowTimeoutErroris raised, which is caughtby the new explicit handler (and would also be caught by the existing
except Exceptionfallback).This ensures
read()always returns a usable value (default_return_val) andwrite()nevercrashes the caller.
Test results
All 60 tests pass (test_concore.py + test_concoredocker.py + test_protocol_conformance.py).
Fixes #393