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

[BUG][Blob Storage] 0 byte blobs are uploaded if incorrect length is specified #13092

Closed
3 tasks done
SukruthKS opened this issue Jul 13, 2020 · 4 comments · Fixed by #13144
Closed
3 tasks done

[BUG][Blob Storage] 0 byte blobs are uploaded if incorrect length is specified #13092

SukruthKS opened this issue Jul 13, 2020 · 4 comments · Fixed by #13144
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. pillar-reliability The issue is related to reliability, one of our core engineering pillars. (includes stress testing) Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)

Comments

@SukruthKS
Copy link

Describe the bug
With the new beta version of the blob storage SDK 12.8.0-beta.1, zero length blobs are uploaded if the specified blob size does not match with the input stream. This can mislead applications into believing that blobs have been uploaded correctly. The previous version of the SDK threw an error instead of uploading the blob.

Exception or Stack Trace
NA

To Reproduce
Sample code to repro this:

final String containerName = "<container_name>";
final String blobName = "<blob_name>";

final String content = "Hello World!";
final byte[] contentBytes = content.getBytes();

try(InputStream inStream = new ByteArrayInputStream(contentBytes))
{
    BlobClient blobClient = serviceClient.getBlobContainerClient(containerName)
        .getBlobClient(blobName);

    blobClient.upload(inStream, contentBytes.length + 10); // Incorrect length

    BlobProperties properties = blobClient.getProperties();
    System.out.println("Blob size: " + properties.getBlobSize());
}

Output with 12.8.0-beta.1:

Blob size: 0

Output with 12.7.0:

Exception in thread "main" com.azure.core.exception.UnexpectedLengthException: Request body emitted 12 bytes, less than the expected 22 bytes.

Code Snippet
Added above

Expected behavior
Either the SDK should throw an error if the lengths did not match or treat the input stream as source of truth and upload the content available from the stream.

Screenshots
NA

Setup (please complete the following information):

  • OS: Linux
  • IDE : IntelliJ
  • Version of the Library used: 12.8.0-beta.1

Additional context
NA

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@ghost ghost added needs-triage Workflow: 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 Jul 13, 2020
@joshfree joshfree added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) pillar-reliability The issue is related to reliability, one of our core engineering pillars. (includes stress testing) labels Jul 13, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Jul 13, 2020
@joshfree
Copy link
Member

@rickle-msft @gapra-msft can you please take a look?

@rickle-msft
Copy link
Contributor

@SukruthKS Thank you for reporting this. I am taking a look now

@rickle-msft rickle-msft removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label Jul 13, 2020
@Petermarcu Petermarcu added the Service Attention Workflow: This issue is responsible by Azure service team. label Jul 14, 2020
@ghost
Copy link

ghost commented Jul 14, 2020

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

@rickle-msft
Copy link
Contributor

@SukruthKS FYI I just put out a PR for this.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 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. pillar-reliability The issue is related to reliability, one of our core engineering pillars. (includes stress testing) Service Attention Workflow: This issue is responsible by Azure service team. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants