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

Azurite doesn't match Azure when downloading byte range from empty blob #2410

Closed
mikamins opened this issue Jun 7, 2024 · 2 comments
Closed
Assignees
Labels
blob-storage bug Something isn't working

Comments

@mikamins
Copy link

mikamins commented Jun 7, 2024

Which service(blob, file, queue, table) does this issue concern?

blob

Which version of the Azurite was used?

v3.30.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

npm

What's the Node.js version?

v20.10.0

What problem was encountered?

When downloading a byte range from a 0-sized blob, Azurite is successful (206), while a real storage account returns an error (416)

Steps to reproduce the issue?

azurite.log shows:

  1. Create container
  2. Upload an empty blob
  3. Download a byte range from that blob

Azurite response

HTTP/1.1 206 Partial Content
Server: Azurite-Blob/3.30.0
last-modified: Fri, 07 Jun 2024 15:59:24 GMT
x-ms-creation-time: Fri, 07 Jun 2024 15:59:24 GMT
content-length: 0
content-type: application/octet-stream
content-range: bytes 0--1/0
etag: "0x1F20D878DBCF020"
content-md5: 1B2M2Y8AsgTpgAmY7PhCfg==
x-ms-blob-type: BlockBlob
x-ms-lease-state: available
x-ms-lease-status: unlocked
x-ms-client-request-id: 2f17c3a5-75b0-4d26-8bdb-fd485bf9cb96
x-ms-request-id: 24e1b533-7213-4936-842d-9108c42b811d
x-ms-version: 2024-05-04
accept-ranges: bytes
date: Fri, 07 Jun 2024 15:59:24 GMT
x-ms-server-encrypted: true
x-ms-blob-content-md5: 1B2M2Y8AsgTpgAmY7PhCfg==
Connection: keep-alive
Keep-Alive: timeout=5

Azure response in same scenario

HTTP/1.1 416 The range specified is invalid for the current size of the resource.
Content-Length: 249
Content-Type: application/xml
Content-Range: bytes */0
Server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 091c4acf-b01e-0045-64f3-b846c2000000
x-ms-client-request-id: b5093669-485f-496f-9eda-b375dd8b65d3
x-ms-version: 2019-12-12
x-ms-error-code: InvalidRange
Date: Fri, 07 Jun 2024 15:57:39 GMT

<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidRange</Code><Message>The range specified is invalid for the current size of the resource.
RequestId:091c4acf-b01e-0045-64f3-b846c2000000
Time:2024-06-07T15:57:39.2526413Z</Message></Error>

Have you found a mitigation/solution?

No

@blueww blueww self-assigned this Jun 11, 2024
@blueww blueww added bug Something isn't working blob-storage labels Jun 11, 2024
@blueww
Copy link
Member

blueww commented Jun 11, 2024

@mikamins

Thanks for reporting this issue!
We will look into how to fix it.

Azurite welcome contribution!
It would be great if you could raise a PR to fix it!

The fix might can be: adding code to the following place, to report error when "x-ms-rage" end is bigger than blob length and blob length is 0 :
Block & Append:

if (rangeEnd + 1 >= blob.properties.contentLength!) {

Page:
if (rangeEnd + 1 >= blob.properties.contentLength!) {

@blueww
Copy link
Member

blueww commented Jul 2, 2024

Close as the fix PR has been merged, will be in next Azurite release.

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

No branches or pull requests

2 participants