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

ZipArchive backed IBlobStorage throws occasionally when calling WriteAsync #38

Open
ckpearson opened this issue Sep 13, 2023 · 2 comments
Labels
bug Something isn't working Zip

Comments

@ckpearson
Copy link

Sometimes when doing the following:

using var stream = ... // a Stream here
await blobStorage.WriteAsync("path_here", stream);

OR:

var stream = ... // a Stream here
await blobStorage.WriteAsync("path_here", stream);
await stream.DisposeAsync();

OR:

var bytes = ... // a byte array
await blobStorage.WriteAsync("path_here", bytes);

Occasionally a System.ObjectDisposedException: 'Cannot access a closed file.' will be raised.

This code path is being called by a background processor that utilises a worker pool, the idea being that files for writing are enqueued as tasks, and the pool will wait for all tasks to complete; so I'm wondering if there's a threading / async issue occurring here?

@ckpearson
Copy link
Author

If I set my worker pool to only have a single worker (essentially emulating sequential processing) then the issue does disappear.

@robinrodricks
Copy link
Owner

Any fix and PR will be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Zip
Projects
None yet
Development

No branches or pull requests

2 participants