Conversation
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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.
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 <fshb1988@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
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.