Conversation
oboehmer
requested review from
ChristopherJHart and
aitestino
and removed request for
ChristopherJHart
September 11, 2026 13:42
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.
Description
Cancels the underlying
asynciocoroutine whenfuture.result(timeout=DEVICE_EXECUTE_TIMEOUT)times out inSSHTestBase._patch_device_execute_for_broker(), and ensuresBrokerClienttears down the socket connection on cancellation to prevent zombie coroutines from blocking subsequent broker commands or reusing a desynchronized socket stream.Closes
Related Issue(s)
Type of Change
Test Framework Affected
Network as Code (NaC) Architecture Affected
Platform Tested
Key Changes
ssh_base_test.py: CatchTimeoutErroronfuture.result(timeout=DEVICE_EXECUTE_TIMEOUT)and invokefuture.cancel()to cancel the underlying task on the event loop.broker_client.py: Catchasyncio.CancelledErrorin_send_requestand callself._teardown_connection()so the cancelled in-flight socket stream is cleanly reset and cannot corrupt or stall the next command.test_ssh_base_test.py: Added assertion thatmock_future.cancel()is called on timeout.test_connection_broker.py: AddedTestBrokerClientCancellationverifying that a cancelled hanging request tears down the connection and enables subsequent commands on the client to reconnect and succeed without queueing or errors.Testing Done
pytest/pre-commit run -a)Test Commands Used
Checklist
pre-commit run -apasses)Screenshots (if applicable)
N/A
Additional Notes
None