Repository navigation
Conversation
Sending a command over a connection that has been closed by the remote server, for example by gvmd after an error response, raised a raw BrokenPipeError/ConnectionResetError from the socket. Reading from a closed connection already results in a GvmError. Convert connection errors raised while sending or reading into a GvmError too, so callers can handle a closed connection consistently and re-connect. The original exception is kept as the cause. Closes greenbone#11 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
greenbonebot
enabled auto-merge (rebase)
November 10, 2026 01:56
Conventional Commits Report
🚀 Conventional commits found. |
This branch has not been deployed
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.
What
AbstractGvmConnection.send()now converts aConnectionError(BrokenPipeError,ConnectionResetError,ConnectionAbortedError) raised by the socket into aGvmError("Remote closed the connection. Error was ...").read()does the same if the socket raises while receiving. The original exception is kept as__cause__.Why
When the remote server has closed the connection, for example gvmd after an error response, the next
send()raised a rawBrokenPipeError/IOErrorfrom the socket, whileread()on a closed connection already raises aGvmError. Callers had to catchIOErrorand checkerrno.EPIPEthemselves to find out that they need to re-connect. With this change a closed connection is reported consistently asGvmErrorfor both directions.This affects
UnixSocketConnectionandTLSConnection, which share the implementation.SSHConnectionhas its ownsend()and is unchanged. Other socket errors such as timeouts are not wrapped.Closes #11
How it was tested
tests/connections/test_gvm_connection.pyfor sending on a closed connection, a reset while reading, sending on an unconnected socket, and for timeouts staying unwrapped.GvmErrorinstead ofConnectionAbortedError.ruff checkandruff format --checkpass.known_hosts) already fail onmain, so I rely on CI for the full test suite andmypy.🤖 Generated with Claude Code