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

PutObjectArgs - should be made disposable #879

Open
ievgen-podlasov-pp opened this issue Oct 6, 2023 · 2 comments
Open

PutObjectArgs - should be made disposable #879

ievgen-podlasov-pp opened this issue Oct 6, 2023 · 2 comments

Comments

@ievgen-podlasov-pp
Copy link

This documentation example:
https://min.io/docs/minio/linux/developers/dotnet/API.html#putObject
shows how to create PutObjectArgs instance and call PutObjectAsync(). The problem is that after such call the file on disk is blocked and cannot be modified by other processes until PutObjectArgs instance is garbage collected and finalized. That's because PutObjectArgs.ObjectStreamData property is assigned to the proper FileStream (used to read the file being uploaded), but this FileStream is never closed until PutObjectArgs instance is finalized. Making PutObjectArgs disposable could solve this problem. Or MinioClient could close the stream after it is done with PutObjectAsync() and reopen it if called again with the same PutObjectArgs .

@Stalli
Copy link

Stalli commented Dec 8, 2023

A workaround would be to use WithStreamData(myStream) instead of WithFilename() and dispose myStream whenever we need.

@strelok372
Copy link

Looks like a bug
I encountered the same situation and changed the way of working with PutObjectArgs to WithStreamData()

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

No branches or pull requests

3 participants