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

POSIX port doesn't copy small files #10

Closed
boredzo opened this issue Sep 12, 2022 · 3 comments
Closed

POSIX port doesn't copy small files #10

boredzo opened this issue Sep 12, 2022 · 3 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers posix-version Bugs in the pure POSIX port.

Comments

@boredzo
Copy link
Owner

boredzo commented Sep 12, 2022

% bin/dd-parallel configure /Volumes/RAM\ Disk/configure
Copied 0 bytes in 0 ms (overall avg 0 bytes/sec)

As much as this is like using a tank as a fly-swatter, dd-parallel should be able to copy any file, big or small.

@boredzo boredzo added bug Something isn't working good first issue Good for newcomers posix-version Bugs in the pure POSIX port. labels Sep 12, 2022
@boredzo boredzo self-assigned this Sep 12, 2022
@boredzo
Copy link
Owner Author

boredzo commented Sep 12, 2022

Debug logging:

Reading into buffer 0
Finished reading into buffer 0
Waiting to read into buffer 1…
Reader generation check: Read gen 0, write gen 0
Reading into buffer 1
Finished reading buffer 1. This is read generation 1, chunk #
Read loop reached end of input file
Read loop exiting
Waiting to write buffer 1 (reader state is 2)…
Writer generation check: Read gen 1, write gen 0
Writing buffer 1, which is chunk #
Finished writing buffer 1. This is write generation 0, chunk #
Write loop exiting because readerState is 4
Copied 0 bytes in 0 ms (overall avg 0 bytes/sec)

@boredzo
Copy link
Owner Author

boredzo commented Sep 12, 2022

Added the read amounts to the log. As expected, the initial read is the length of the file and the second read is 0:

Reading into buffer 0
Finished reading 1546 bytes into buffer 0
Waiting to read into buffer 1…
Reader generation check: Read gen 0, write gen 0
Reading into buffer 1
Finished reading 0 bytes into buffer 1. This is read generation 1, chunk #
Read loop reached end of input file
Read loop exiting
Write loop exiting because readerState is 4
Copied 0 bytes in 0 ms (overall avg 0 bytes/sec)

@boredzo
Copy link
Owner Author

boredzo commented Sep 12, 2022

Seems like the writer thread needs to be controlled not by the reader's state, but on the generation counts. In fact, it seems like this could happen at the end of a long file, not just on a small one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers posix-version Bugs in the pure POSIX port.
Projects
None yet
Development

No branches or pull requests

1 participant