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

[QUERY] Torn write when using BlobClient's UploadAsync #15863

Closed
luckerby opened this issue Oct 12, 2020 · 7 comments
Closed

[QUERY] Torn write when using BlobClient's UploadAsync #15863

luckerby opened this issue Oct 12, 2020 · 7 comments
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@luckerby
Copy link

Is it possible to run into a situation where a piece of code writes using BlobClient's UploadAsync, while a consumer using the DownloadAsync would end up with garbled text?

An example: say a writer uploads 20 MB to a block blob, and a reader starts downloading the blob before the writer completes. Will the result of the read be part of those 20 MB, or would the reader be blocked until the upload completes?

@msftbot msftbot bot added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Oct 12, 2020
@jsquire jsquire added Client This issue points to a problem in the data-plane of the library. needs-team-attention This issue needs attention from Azure service team or SDK team Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files) labels Oct 12, 2020
@msftbot msftbot bot removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Oct 12, 2020
@msftbot
Copy link

msftbot bot commented Oct 12, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@jsquire
Copy link
Member

jsquire commented Oct 12, 2020

Thank you for your feedback. Tagging and routing to the team best able to assist.

@seanmcc-msft
Copy link
Member

Hi,

The download request will return an empty stream. The BlobClient.Upload() API is really calling Put Block and Put Block List under the coverts. The blob content does not become "real" until Put Block List is called.

-Sean

@luckerby
Copy link
Author

@seanmcc-msft thanks! In other words, there's no need to concern myself with a synchronization mechanism, eg locks.

@seanmcc-msft
Copy link
Member

Hi @luckerby, not in this case. You would need to be careful though if you ended up writing to the same blob from multiple threads.

@luckerby
Copy link
Author

@seanmcc-msft For the multiple writers case, it's probably due to the fact that one of them will "win" when doing Put Block List, essentially overriding what others did.

Is there some synchronization attributes that could be used in the types present in the Azure SDK, or would using standard locking mechanisms (eg lock) be the way to go, in this multiple-writers scenario?

@seanmcc-msft
Copy link
Member

seanmcc-msft commented Oct 13, 2020

@luckerby, that is correct. I recommend avoiding having multiple writers write to the same blob at the same time if possible. If you can't avoid this, I think using lock would be the best way to go.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

3 participants