-
Notifications
You must be signed in to change notification settings - Fork 102
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
read_exact_from
and write_all_to
from GuestMemory
don't have the correct semantics
#174
Comments
Both read_exact_from() and write_all_to() functions from the GuestMemory trait implementation in vm-memory are buggy. They should retry until they wrote or read the amount of data that was expected, but instead they simply return an error when this happens. This causes the migration to fail when trying to send important amount of data through the migration socket, due to large memory regions. This should be eventually fixed in vm-memory, and here is the link to follow up on the issue: rust-vmm/vm-memory#174 Signed-off-by: Sebastien Boeuf <[email protected]>
I agree, they should retry as long as However, there's the problem of returning the number of bytes processed before an IOError. It would be best to change IOError to |
Is this issue related to #171? |
I don't think so. |
Both read_exact_from() and write_all_to() functions from the GuestMemory trait implementation in vm-memory are buggy. They should retry until they wrote or read the amount of data that was expected, but instead they simply return an error when this happens. This causes the migration to fail when trying to send important amount of data through the migration socket, due to large memory regions. This should be eventually fixed in vm-memory, and here is the link to follow up on the issue: rust-vmm/vm-memory#174 Signed-off-by: Sebastien Boeuf <[email protected]>
The rust trait documentation says that
I agree as well, but this is already true. |
Indeed, absolutely not. So I'm not sure what can/should be changed, except possibly adjusting the error type. |
Looking at the cloud-hypervisor commit, that seems like cloud-hypervisor is setting sockets to non-blocking mode? If so, that is certainly something that |
When using the
GuestMemory
implementation ofread_exact_from
andwrite_all_to
, I was expecting they would handle the retry, but they simply return an Error saying they couldn't read or write the entire buffer. That's the wrong behavior IMO, especially because of the naming that suggest they should behave exactly as the Rust traitsRead
andWrite
.The proper solution would be to call underlying functions
read_exact_from
andwrite_all_to
from theGuestRegionMmap
implementation after we found the regions affected by the range, leading to a proper retry when not all data has been read or written./cc @andreeaflorescu @alexandruag @jiangliu
The text was updated successfully, but these errors were encountered: