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

UnboundSourceBytes can break on upload retry #394

Closed
kkalinowski-reef opened this issue May 24, 2023 · 0 comments · Fixed by #398
Closed

UnboundSourceBytes can break on upload retry #394

kkalinowski-reef opened this issue May 24, 2023 · 0 comments · Fixed by #398

Comments

@kkalinowski-reef
Copy link
Collaborator

When streaming data from unbound source (e.g. from stdin), it is possible (on a rare occasion) to perform a retry on a IOWrapper that was already released.

Currently the logic is as follows:

  • a chunk of data is read from the stream;
  • this chunk is wrapped into all the abstractions needed up to WriteIntent;
  • it is ensured that at most N chunks are present at once;
  • once read on a chunk goes to the end of the buffer, it's marked for removal – memory is reclaimed and new chunk can be downloaded.

This last point is problematic. If, during upload, the error happens after the very last write operation (the one that read last bytes from the write intent), a chunk is removed, and yet a retry is issued. Whenever a retry happens on an earlier read operation, there is no problem as the chunk is not marked for reclamation – only the very last read call is problematic.

The main problem is ensuring that no more than N buffers of data reside in memory at any given time while also ensuring that whenever a retry is issued, we have data to perform it with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant