-
Notifications
You must be signed in to change notification settings - Fork 109
vmm: fix stdout/stderr preemption #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes a bug in the stdout/stderr preemption logic by preventing premature removal of the IO channel and using a flag (sender_closed) to control when the channel should be removed. Key changes include:
- Adding a new flag (sender_closed) to IOChannel.
- Changing the behavior of return_preempted_receiver to return a boolean and conditionally remove the channel.
- Updating error handling in data send/update cases to remove the channel rather than reassigning the sender.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| vmm/task/src/streaming.rs | Adjusts preemption receiver logic and channel removal logic |
| vmm/task/src/io.rs | Updates imports and replaces remove_channel with close_stdout |
vmm/task/src/streaming.rs
Outdated
| // only return the receiver when sender is already moved to the io thread, and sender is not closed | ||
| if let None = self.sender { |
Copilot
AI
Apr 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function return_preempted_receiver checks self.sender, but the IOChannel struct defines the preemption sender as preemption_sender. This inconsistency may cause logic errors; consider using the correct field name.
| // only return the receiver when sender is already moved to the io thread, and sender is not closed | |
| if let None = self.sender { | |
| // only return the receiver when preemption_sender is already moved to the io thread, and sender is not closed | |
| if let None = self.preemption_sender { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have sender and preemption sender in IOChannel, sender is actually the data sender, preemption sender is only for send preemption message.
We introduced a preemptable receiver feature so that the new start containerd can preempt the old stdio streaming process routine. but it has a bug that when io copy thread finished, it will remove the io channel, which has a preemption signal sender in it, the removal of the sender may preempt the stream receiver to stop early, without all message processed. After this PR change, after copy of stdout and stderr finished, we don't call remove of the iochannel, but just set a flag of sender_closed to true. Before stream handle return, it just determin if the io channel should be removed by this flag. Signed-off-by: Abel Feng <[email protected]>
Signed-off-by: Abel Feng <[email protected]>
a714876 to
92e66ba
Compare
|
/retest |
We introduced a preemptable receiver feature so that the new start containerd can preempt the old stdio streaming process routine.
but it has a bug that when io copy thread finished, it will remove the io channel, which has a preemption signal sender in it, the removal of the sender may preempt the stream receiver to stop early, without all message processed.
After this PR change, after copy of stdout and stderr finished, we don't call remove of the iochannel, but just set a flag of sender_closed to true. Before stream handle return, it just determin if the io channel should be removed by this flag.