-
Notifications
You must be signed in to change notification settings - Fork 324
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
XStore C++ tests are failing because Azurite returns wrong md5 #2409
Comments
The Azurite debug log has no error occur, so the error you meet should be reported from c++ SDK. However, from above code, it looks you are using old c++ SDK which is already deprecated. (see link) Would you please see if you can repro this issue with latest c++ SDK? BTW, from the code it looks first upload a blob with 3 bytes length, then download 6 bytes from it. |
Azurite is returning the correct status code 206 and returning the partial content as expected. The issue is in the response headers. The latest C++ SDK performs all operations synchronously, so it can never be adopted by our team within XStore. Could you please investigate why Azurite does not work with Microsoft.Azure.Storage.CPP.v140 v7.5.0? The MD5 and version headers are only major differences I see between the responses from Azurite and Azure/Storage Emulator. One of them is causing issues with the SDK. Considering the exception message says |
From the server responds header (get from fiddler) and Azurite responds header (get from Azurite debug log), of a GetBlob request with "x-ms-range: bytes=0-5" on a blob whose length is 3B. Besides same status code, same content, they also have same Content-Range, Content-Length, x-ms-blob-content-md5 headers. Azurite has one additional header content-md5 whose value is also correct. So not sure why the deprecated C++ SDK report this error. It will need SDK team support to look into deprecated SDK code and find the issue. Azure Server
Azurite
|
Hi @mikamins , we were not able to reproduce this issue with latest versions of Azurite and C++ SDK. Was the attached log generated with your sample code? We found
in your log, |
Hi @mikamins, If you really need the new C++ SDK to support Async call to upgrade to it, you can raise an issue in https://github.com/Azure/azure-sdk-for-cpp/issues to raise your requirement. |
Yes, the attached log was created with the sample code, and using Azurite 3.30 and azure-storage-cpp 7.50. If you are unable to reproduce, could you provide the exact versions that you used and attach the log? |
I stepped through the sample code in more detail, and the SDK is doing the right thing. Azurite is returning the incorrect md5 when downloading the blob. Blob setup:
Failing download:
Log is attached: Download HTTP Request:
Response with bad
|
@blueww This seems to be a bug in Azurite. Azurite doesn't clear all blob properties when it's overwritten. |
Thanks for the investigation! |
I can't repro this with Azurite. After look into the debug log shared in the above comment from you, I see you have set header 2024-06-18T00:17:02.633Z 63c975e5-7b5d-4755-ac9a-a65e617053c7 info: BlobStorageContextMiddleware: RequestMethod=PUT RequestURL=http://127.0.0.1/devstoreaccount1/unittest/E2642A3C-58CF-4CA4-A7C5-2CE4C7A29B91?comp=blocklist RequestHeaders:{"connection":"Keep-Alive","content-type":"","authorization":"SharedKey devstoreaccount1:bprNXXG2v3W9YXS4l8Z9KS6A4MYYoiOhsMWQWqSoKd0=","user-agent":"Azure-Storage/7.5.0 (Native; Windows; MSC_VER 1900)","x-ms-blob-content-md5":"1B2M2Y8AsgTpgAmY7PhCfg==","x-ms-client-request-id":"31a5ac86-f1a3-458a-ba22-cc4400be02a9","x-ms-date":"Tue, 18 Jun 2024 00:17:02 GMT","x-ms-version":"2019-12-12","content-length":"90","host":"127.0.0.1:10000"} ClientIP=127.0.0.1 Protocol=http HTTPVersion=1.1 |
@blueww Track1 SDK keeps state of a blob at client side (state includes blob properties). Is it possible that when we get properties of the old blob (empty content), the local state is populated, then md5 is sent out over the wire when calling CommitBlocks? This cannot be reproed with public Azure because public Azure service doesn't return blob-md5 for partial read. Hmm, it explains everything. |
Thanks @Jinming-Hu for the investigation! Per rest API doc, Put Blob should return Content-MD5, and Azurite is aligned with the rest API doc. @mikamins |
per REST API doc
Azurite should fix its wrong behavior. |
The REST API doc you shared is for Get blob API. |
@blueww I don't think we're on the same page. Anyway, the workaround you proposed does sound good to me. |
Close as the fix PR (#2417 Download blob range only return ContentMD5 when request has header x-ms-range-get-content-md5) has been merged, will be in next Azurite release. |
Which service(blob, file, queue, table) does this issue concern?
blob
Which version of the Azurite was used?
3.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?
My team in XStore is trying to migrate tests from Storage Emulator to Azurite. We are blocked by failures that occur only when using Azurite.
The following code is a simplified example of the problem. It works against a real storage account and Storage Emulator.
With Azurite, it throws a
storage_exception
indicatingCalculated MD5 does not match existing property.
Steps to reproduce the issue?
If possible, please provide the debug log
azurite.log
Have you found a mitigation/solution?
No
The text was updated successfully, but these errors were encountered: