Azure / Azure/Azurite

Blob_Download: Don't repor error when give invalid range

Open
#318 2 comments 0 reactions 1 assignee Claimed by @blueww View on GitHub
blob-storage NewArch stale
Dominant language
TypeScript
Stars
2.3k
Forks
393
Avg merge
1d 20h
Merged PRs (30d)
36

Description

### Which service(blob, file, queue, table) does this issue concern?
blob
### Which version of the Azurite was used?
3.3.0-preview
### Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)
VS code
### What's the Node.js version?
v10.15.3
### What problem was encountered?
Blob_Download: Don't repor error when give invalid range
### Steps to reproduce the issue?
Upload a blob length 1024 byte. (so offset are 0-1023)
Download 1 byte from the offset on 1024, Azurite doesn't fail the request.
### Have you found a mitigation/solution?

Test case:
```
Test Name: CloudBlockBlobDownloadRangeToByteArrayNegativeTests
Test FullName: Microsoft.Azure.Storage.Blob.BlobUploadDownloadTest.CloudBlockBlobDownloadRangeToByteArrayNegativeTests
Test Source: C:\code\azure-storage-net\Test\ClassLibraryCommon\Blob\BlobUploadDownloadTest.cs : line 3255
Test Outcome: Failed
Test Duration: 0:00:00.0967804

Result StackTrace:
at Microsoft.Azure.Storage.TestHelper.ExpectedException(Action operation, String operationDescription, HttpStatusCode expectedStatusCode, String requestErrorCode) in C:\code\azure-storage-net\Test\ClassLibraryCommon\TestHelper.cs:line 55
at Microsoft.Azure.Storage.Blob.BlobUploadDownloadTest.DoDownloadRangeToByteArrayNegativeTests(ICloudBlob blob) in C:\code\azure-storage-net\Test\ClassLibraryCommon\Blob\BlobUploadDownloadTest.cs:line 3286
at Microsoft.Azure.Storage.Blob.BlobUploadDownloadTest.CloudBlockBlobDownloadRangeToByteArrayNegativeTests() in C:\code\azure-storage-net\Test\ClassLibraryCommon\Blob\BlobUploadDownloadTest.cs:line 3258
Result Message: Assert.Fail failed. No Storage exception received while expecting RequestedRangeNotSatisfiable: Try invalid length

```

Debug Log:
```
2019-12-17T08:06:29.316Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: BlobStorageContextMiddleware: RequestMethod=PUT RequestURL=http://127.0.0.1/devstoreaccount1/testc7a30764e575f41bc9290581c9f55764f/blob1 RequestHeaders:{"x-ms-blob-content-md5":"qMHy69kmSJIWnJt9rkiBXQ==","x-ms-blob-type":"BlockBlob","x-ms-client-request-id":"dc61722a-51ba-4a08-84a7-f43bf323d375","user-agent":"Azure-Storage/11.1.1 (.NET Core; Win32NT 6.2.9200.0)","x-ms-version":"2019-02-02","x-ms-date":"Tue, 17 Dec 2019 08:06:29 GMT","authorization":"SharedKey devstoreaccount1:v8njBXx0nElgIU+PFsF3ZM0d94+ydCKEMRJjRXWrfcw=","content-length":"1024","host":"127.0.0.1:10000"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2019-12-17T08:06:29.317Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=testc7a30764e575f41bc9290581c9f55764f Blob=blob1
2019-12-17T08:06:29.317Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 verbose: DispatchMiddleware: Dispatching request...
2019-12-17T08:06:29.318Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: DispatchMiddleware: Operation=BlockBlob_Upload
2019-12-17T08:06:29.318Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2019-12-17T08:06:29.318Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: PublicAccessAuthenticator:validate() Start validation against public access.
2019-12-17T08:06:29.319Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: PublicAccessAuthenticator:validate() Getting account properties...
2019-12-17T08:06:29.319Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: PublicAccessAuthenticator:validate() Retrieved account name from context: devstoreaccount1, container: testc7a30764e575f41bc9290581c9f55764f, blob: blob1
2019-12-17T08:06:29.323Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: PublicAccessAuthenticator:validate() Skip public access authentication. Cannot get public access type for container testc7a30764e575f41bc9290581c9f55764f
2019-12-17T08:06:29.323Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: BlobSharedKeyAuthenticator:validate() Start validation against account shared key authentication.
2019-12-17T08:06:29.323Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: BlobSharedKeyAuthenticator:validate() [STRING TO SIGN]:"PUT\n\n\n1024\n\n\n\n\n\n\n\n\nx-ms-blob-content-md5:qMHy69kmSJIWnJt9rkiBXQ==\nx-ms-blob-type:BlockBlob\nx-ms-client-request-id:dc61722a-51ba-4a08-84a7-f43bf323d375\nx-ms-date:Tue, 17 Dec 2019 08:06:29 GMT\nx-ms-version:2019-02-02\n/devstoreaccount1/devstoreaccount1/testc7a30764e575f41bc9290581c9f55764f/blob1"
2019-12-17T08:06:29.323Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: BlobSharedKeyAuthenticator:validate() Calculated authentication header based on key1: SharedKey devstoreaccount1:v8njBXx0nElgIU+PFsF3ZM0d94+ydCKEMRJjRXWrfcw=
2019-12-17T08:06:29.323Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: BlobSharedKeyAuthenticator:validate() Signature 1 matched.
2019-12-17T08:06:29.324Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 verbose: DeserializerMiddleware: Start deserializing...
2019-12-17T08:06:29.324Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: HandlerMiddleware: DeserializedParameters={"options":{"metadata":{},"requestId":"dc61722a-51ba-4a08-84a7-f43bf323d375","blobHTTPHeaders":{"blobContentMD5":{"type":"Buffer","data":[168,193,242,235,217,38,72,146,22,156,155,125,174,72,129,93]}},"leaseAccessConditions":{},"cpkInfo":{},"modifiedAccessConditions":{}},"contentLength":1024,"version":"2019-02-02","blobType":"BlockBlob","body":"ReadableStream"}
2019-12-17T08:06:29.326Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue.operate() Schedule incoming job 71351eac-f3bb-4388-a0ab-f8f4626dfa11
2019-12-17T08:06:29.326Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue:execute() Current runningConcurrency:0 maxConcurrency:10 operations.length:1
2019-12-17T08:06:29.326Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: FSExtentStore:appendExtent() Select extent from idle location for extent append operation. LocationId:1 extentId:ed4afb3d-f78e-42f5-a41c-b8deb9af386b offset:3146752 MAX_EXTENT_SIZE:4194304
2019-12-17T08:06:29.326Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: FSExtentStore:appendExtent() Get fd:4 for extent:ed4afb3d-f78e-42f5-a41c-b8deb9af386b from cache.
2019-12-17T08:06:29.326Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: FSExtentStore:appendExtent() Start writing to extent ed4afb3d-f78e-42f5-a41c-b8deb9af386b
2019-12-17T08:06:29.327Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: FSExtentStore:appendExtent() Write finish, start updating extent metadata. extent:{"id":"ed4afb3d-f78e-42f5-a41c-b8deb9af386b","persistencyId":"Default","path":"ed4afb3d-f78e-42f5-a41c-b8deb9af386b","size":3147776,"lastModifiedInMS":1576569989327}
2019-12-17T08:06:29.327Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: FSExtentStore:appendExtent() Update extent metadata done. Resolve()
2019-12-17T08:06:29.327Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue.operate() Job 71351eac-f3bb-4388-a0ab-f8f4626dfa11 completes callback, resolve.
2019-12-17T08:06:29.328Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue.operate() Schedule incoming job f616509a-82d3-4335-992a-6523f3a30b23
2019-12-17T08:06:29.328Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue:execute() Current runningConcurrency:0 maxConcurrency:100 operations.length:1
2019-12-17T08:06:29.328Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 verbose: FSExtentStore:readExtent() Creating read stream. LocationId:Default extentId:ed4afb3d-f78e-42f5-a41c-b8deb9af386b path:__blobstorage__\ed4afb3d-f78e-42f5-a41c-b8deb9af386b offset:3146752 count:1024 end:3147775
2019-12-17T08:06:29.328Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue.operate() Job f616509a-82d3-4335-992a-6523f3a30b23 completes callback, resolve.
2019-12-17T08:06:29.328Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue:execute() Current runningConcurrency:0 maxConcurrency:10 operations.length:0
2019-12-17T08:06:29.329Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue:execute() return. Operation.length === 0
2019-12-17T08:06:29.329Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue:execute() Current runningConcurrency:0 maxConcurrency:100 operations.length:0
2019-12-17T08:06:29.329Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 debug: OperationQueue:execute() return. Operation.length === 0
2019-12-17T08:06:29.338Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 verbose: SerializerMiddleware: Start serializing...
2019-12-17T08:06:29.338Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 info: EndMiddleware: End response. TotalTimeInMS=22 StatusCode=201 StatusMessage=undefined Headers={"server":"Azurite-Blob/3.3.0-preview","etag":"\"d-uSDtT8mNCULqZoFt0VrwuQ8d0HU\"","last-modified":"Tue, 17 Dec 2019 08:06:29 GMT","content-md5":"qMHy69kmSJIWnJt9rkiBXQ==","x-ms-client-request-id":"dc61722a-51ba-4a08-84a7-f43bf323d375","x-ms-request-id":"ff7bf0b8-83c3-422c-a2db-533d2199c8f9","x-ms-version":"2019-02-02","date":"Tue, 17 Dec 2019 08:06:29 GMT","x-ms-request-server-encrypted":"true"}
2019-12-17T08:06:29.339Z ff7bf0b8-83c3-422c-a2db-533d2199c8f9 verbose: FSExtentStore:readExtent() Read stream closed. LocationId:Default extentId:ed4afb3d-f78e-42f5-a41c-b8deb9af386b path:__blobstorage__\ed4afb3d-f78e-42f5-a41c-b8deb9af386b offset:3146752 count:1024 end:3147775
2019-12-17T08:06:48.014Z info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2019-12-17T08:06:48.015Z info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.
2019-12-17T08:06:48.248Z info: BlobGCManager:markSweepLoop() Start next mark and sweep.
2019-12-17T08:06:48.249Z info: BlobGCManager:markSweep() Get all extents.
2019-12-17T08:06:48.250Z info: BlobGCManager:markSweep() Got 14 extents.
2019-12-17T08:06:48.250Z info: BlobGCManager:markSweep() Get referred extents.
2019-12-17T08:06:48.252Z info: BlobGCManager:markSweep() Got referred extents, unreferenced extents count is 0.
2019-12-17T08:06:48.252Z info: BlobGCManager:markSweepLoop() Mark and sweep finished, taken 4ms.
2019-12-17T08:06:48.252Z info: BlobGCManager:markSweepLoop() Sleep for 600000ms.
2019-12-17T08:07:07.557Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobStorageContextMiddleware: RequestMethod=GET RequestURL=http://127.0.0.1/devstoreaccount1/testc7a30764e575f41bc9290581c9f55764f/blob1 RequestHeaders:{"x-ms-range":"bytes=1024-1024","x-ms-client-request-id":"fe6b3d54-e6bb-4328-9228-4a6e4f7c8c40","user-agent":"Azure-Storage/11.1.1 (.NET Core; Win32NT 6.2.9200.0)","x-ms-version":"2019-02-02","x-ms-date":"Tue, 17 Dec 2019 08:07:07 GMT","authorization":"SharedKey devstoreaccount1:bsaGDeqELWRVh8ZUu/EpOMtuwIlVjxY3Qob06TSmFzg=","host":"127.0.0.1:10000"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1
2019-12-17T08:07:07.558Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobStorageContextMiddleware: Account=devstoreaccount1 Container=testc7a30764e575f41bc9290581c9f55764f Blob=blob1
2019-12-17T08:07:07.558Z ef67d559-0075-4073-89f6-9a051ecc2418 verbose: DispatchMiddleware: Dispatching request...
2019-12-17T08:07:07.559Z ef67d559-0075-4073-89f6-9a051ecc2418 info: DispatchMiddleware: Operation=Blob_Download
2019-12-17T08:07:07.560Z ef67d559-0075-4073-89f6-9a051ecc2418 verbose: AuthenticationMiddlewareFactory:createAuthenticationMiddleware() Validating authentications.
2019-12-17T08:07:07.560Z ef67d559-0075-4073-89f6-9a051ecc2418 info: PublicAccessAuthenticator:validate() Start validation against public access.
2019-12-17T08:07:07.561Z ef67d559-0075-4073-89f6-9a051ecc2418 debug: PublicAccessAuthenticator:validate() Getting account properties...
2019-12-17T08:07:07.561Z ef67d559-0075-4073-89f6-9a051ecc2418 debug: PublicAccessAuthenticator:validate() Retrieved account name from context: devstoreaccount1, container: testc7a30764e575f41bc9290581c9f55764f, blob: blob1
2019-12-17T08:07:07.573Z ef67d559-0075-4073-89f6-9a051ecc2418 debug: PublicAccessAuthenticator:validate() Skip public access authentication. Cannot get public access type for container testc7a30764e575f41bc9290581c9f55764f
2019-12-17T08:07:07.574Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobSharedKeyAuthenticator:validate() Start validation against account shared key authentication.
2019-12-17T08:07:07.574Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobSharedKeyAuthenticator:validate() [STRING TO SIGN]:"GET\n\n\n\n\n\n\n\n\n\n\n\nx-ms-client-request-id:fe6b3d54-e6bb-4328-9228-4a6e4f7c8c40\nx-ms-date:Tue, 17 Dec 2019 08:07:07 GMT\nx-ms-range:bytes=1024-1024\nx-ms-version:2019-02-02\n/devstoreaccount1/devstoreaccount1/testc7a30764e575f41bc9290581c9f55764f/blob1"
2019-12-17T08:07:07.575Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobSharedKeyAuthenticator:validate() Calculated authentication header based on key1: SharedKey devstoreaccount1:bsaGDeqELWRVh8ZUu/EpOMtuwIlVjxY3Qob06TSmFzg=
2019-12-17T08:07:07.575Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobSharedKeyAuthenticator:validate() Signature 1 matched.
2019-12-17T08:07:07.575Z ef67d559-0075-4073-89f6-9a051ecc2418 verbose: DeserializerMiddleware: Start deserializing...
2019-12-17T08:07:07.576Z ef67d559-0075-4073-89f6-9a051ecc2418 info: HandlerMiddleware: DeserializedParameters={"options":{"range":"bytes=1024-1024","requestId":"fe6b3d54-e6bb-4328-9228-4a6e4f7c8c40","leaseAccessConditions":{},"cpkInfo":{},"modifiedAccessConditions":{}},"version":"2019-02-02"}
2019-12-17T08:07:07.584Z ef67d559-0075-4073-89f6-9a051ecc2418 info: BlobHandler:downloadBlockBlob() NormalizedDownloadRange=bytes=1024-1023 RequiredContentLength=0
2019-12-17T08:07:07.585Z ef67d559-0075-4073-89f6-9a051ecc2418 verbose: SerializerMiddleware: Start serializing...
2019-12-17T08:07:07.586Z ef67d559-0075-4073-89f6-9a051ecc2418 info: Serializer: Start returning stream body.
2019-12-17T08:07:48.015Z info: AccountDataStore:init() Refresh accounts from environment variable AZURITE_ACCOUNTS with value undefined
2019-12-17T08:07:48.016Z info: AccountDataStore:init() Fallback to default emulator account devstoreaccount1.

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.