Skip to content
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

Syncing images of different sizes with a non-divisible block size fails #4

Open
PhrozenByte opened this issue May 12, 2022 · 0 comments
Labels

Comments

@PhrozenByte
Copy link
Owner

PhrozenByte commented May 12, 2022

Trying to sync images of different sizes with a non-divisible block size (e.g. syncing a source image of 10 MiB to a target image of 12 MiB with a block size of 4 MiB) fails with the following error:

RuntimeError: Can't sync images of different sizes with a non-divisible block size

This is expected behaviour for now. You must either switch to a divisible block size (e.g. 2 MiB), or ensure that both images match in size, or sync to a non-existing (or zero-length) target image.

The reason is that the last blocks of the images don't match in size (e.g. 2 MiB for the source image, but 4 MiB for the target image). This will not only cause the last block to be always considered different, but will also confuse communications. Right now we don't really use a network protocol, but rather dump raw data. This works because all components are synced and know how many bytes they must read or write. However, due to the size mismatch the sender will send just 2 MiB for the last block, but the receiver will expect 4 MiB - what will cause the program to hang indefinitely.

The only solution is to implement a proper network protocol with package sizes. Also see #3.

PhrozenByte added a commit that referenced this issue May 12, 2022
We specifically don't support syncing images of different sizes with a non-divisible block size. See #4 for more info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant