fix: raise TimeoutError on ZMQ retry exhaustion (#393)#488
Open
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
Open
fix: raise TimeoutError on ZMQ retry exhaustion (#393)#488GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
GaneshPatil7517 wants to merge 1 commit intoControlCore-Project:devfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes issue #393 by changing ZeroMQ retry-exhaustion behavior to raise TimeoutError instead of returning None, and updating read()/write() call sites (plus tests) to handle the timeout gracefully and avoid downstream TypeErrors in user code.
Changes:
- Raise
TimeoutErrorfromZeroMQPort.send_json_with_retry()andZeroMQPort.recv_json_with_retry()when retries are exhausted. - Catch
TimeoutErrorinread()(return default + setlast_read_status="TIMEOUT") and inwrite()(log and continue). - Add regression tests for timeout exhaustion behavior in both
concoreandconcoredocker.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| concore_base.py | Converts ZMQ retry exhaustion into TimeoutError and updates read()/write() to handle it safely. |
| tests/test_concore.py | Adds regression tests for send/recv timeout exhaustion and caller handling in concore. |
| tests/test_concoredocker.py | Adds regression tests ensuring concoredocker read/write tolerate ZMQ timeout exhaustion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
) send_json_with_retry() and recv_json_with_retry() now raise TimeoutError instead of silently returning None when all 5 retries are exhausted. read() and write() catch the new exception so callers never see an unhandled crash. - send_json_with_retry: raise TimeoutError (was: return) - recv_json_with_retry: raise TimeoutError (was: return None) - read(): except TimeoutError -> (default, False), status TIMEOUT - read(): remove dead 'message is None' guard (now unreachable) - write(): except TimeoutError -> log and continue - tests: save/restore global state in try/finally to prevent leakage - test_read_status: use TimeoutError instead of response=None Tests added in test_concore.py and test_concoredocker.py. All 75 tests pass. Closes ControlCore-Project#393
6615699 to
30ecc5e
Compare
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_retryreturnedNoneon exhausted retries, causingTypeErrorcrashes in callers.Changes (3 files, minimal diff)
concore_base.pysend_json_with_retry()- raisesTimeoutError(was: barereturn)recv_json_with_retry()- raisesTimeoutError(was:return None)read()- catchesTimeoutError, setslast_read_status = "TIMEOUT", returns(default, False)write()- catchesTimeoutError, logs and continuesTests
test_concore.py: 4 tests (recv raises, send raises, read default, write safe)test_concoredocker.py: 2 tests (read default, write safe)All 75 tests pass locally.