fix(net): break tx loop on non-recoverable errors to prevent busy-loop#606
Open
areporeporepo wants to merge 1 commit intocontainers:mainfrom
Open
fix(net): break tx loop on non-recoverable errors to prevent busy-loop#606areporeporepo wants to merge 1 commit intocontainers:mainfrom
areporeporepo wants to merge 1 commit intocontainers:mainfrom
Conversation
When process_tx() returns a persistent error other than NothingWritten (e.g. Internal or ProcessNotRunning), the loop in process_tx_loop() continues spinning if the guest keeps supplying TX buffers, because tx_has_deferred_frame is false and has_new_entries is true. Break immediately on non-recoverable errors instead of returning false. The worker will be re-entered on the next TX queue kick or backend socket writable event from epoll. Fixes: containers#602 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: anh nguyen <anh.nqqq@icloud.com> Signed-off-by: anh nguyen <29374105+areporeporepo@users.noreply.github.com>
Collaborator
|
/gemini review |
Collaborator
|
@mtjhrc PTAL |
There was a problem hiding this comment.
Code Review
This pull request modifies the virtio net worker to break the TX processing loop upon encountering non-recoverable errors. This change is intended to prevent potential busy-looping scenarios where a guest continues to provide TX buffers despite backend failures. I have no feedback to provide as there were no review comments to evaluate.
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 #602.
When
process_tx()returns a persistent error other thanNothingWritten(e.g.InternalorProcessNotRunning), the loop inprocess_tx_loop()continues spinning if the guest keeps supplying TX buffers, becausetx_has_deferred_frameisfalseandhas_new_entriesistrue:Fix
Break immediately on non-recoverable errors. The worker will be re-entered on the next:
This is safe because
InternalandProcessNotRunningerrors are non-transient — retrying immediately won't resolve them, but the next epoll cycle gives the system a chance to recover or the guest driver to reset.Change
self.tx_has_deferred_frame = match self.process_tx() { Err(TxError::Backend(WriteError::NothingWritten)) => true, Err(e) => { - false + break; } _ => false, };Testing
cargo clippy --features net -- -D warningspassescargo fmt -- --checkpasses