ETag and Bytes discrepancy with a Put Block List replacing the same Block Blob
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nodejs, typescript
Direzione di ricerca
Start in LokiBlobMetadataStore.downloadBlob, which returns the live LokiJS record, and compare it with commitBlockList, which updates that record in place; BlobHandler reads blob.properties.etag after awaiting the body stream. The proposed fix is to return a copy of the record, and the test to add is tests/blob/unit/lokiBlobMetadataStore.unit.test.ts (@loki). Done when the downloaded model keeps v1's ETag, content length and block list after a v2 commit, and the test passes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When a ranged Get Blob runs while a Put Block List is replacing the same Block Blob, Azurite can return the new ETag together with the old bytes. Discovered when testing the operations against the container, used via a git patch file against the docker image for now but have a PR up to solve this issue also.
Details
downloadBlob returns the live LokiJS record, because LokiJS doesn't copy records on read. BlobHandler reads the block list, then waits on the body stream and the range MD5, and only then reads blob.properties.etag. During that wait, commitBlockList updates the same record in place. The response then pairs the old bytes, and an MD5 of those bytes, with the new ETag.
Clients can't detect this:
If-Match on later ranges passes, because the first range already returned the new ETag.
Each range's MD5 matches its own bytes, so content validation passes.
A chunked read returns a mix of two versions: old bytes in the first range and new bytes after.
On upstream 3.37.0, about half of the reads that ran alongside a commit came back mixed (264 of 540), with 0 MD5 mismatches. Real Azure serves each read from one version.
Proposed fix
Only affects the Loki metadata store.
Make LokiBlobMetadataStore.downloadBlob return a copy of the record instead of the live LokiJS record:
return structuredClone(doc); // was return doc;
commitBlockList makes all its changes with no await in between. So a copy taken by downloadBlob always holds one complete version, old or new. The ETag, block list and content length in a response then always belong to the same version.
The callers (block, page and append blob handlers, and copy) only read the returned model and never write it back, so a copy works for all of them. structuredClone needs Node 17 or later, and engines already requires Node 22 or later.
Test
A new unit test, tests/blob/unit/lokiBlobMetadataStore.unit.test.ts (@loki), uses an in-memory Loki store:
- Commit v1 of a Block Blob.
- Call
downloadBlob. - Commit v2.
- Check that the downloaded model still has v1's ETag, content length and block list, and that a new
downloadBlobreturns v2.
Without the fix the test fails with 'etag-v2' !== 'etag-v1'.
- Lingua principale
- TypeScript
- Stelle
- 2.3k
- Fork
- 399
- Merge medio
- 1g 2h
- PR unite (30g)
- 49
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Azure/Azurite
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Azure/Azurite#2865 · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Get Blob with Range bytes=-1 returns 500Forse già presa @hippi345 l’ha presa 8 giorni fa. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Acquiring a blob lease without a duration causes later requests to return 500Forse già presa @hippi345 l’ha presa 8 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
PUT to a snapshot URL overwrites the base blobForse già presa @hippi345 l’ha presa 8 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
Azure/Azurite#2844 · 2 reazioni ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Azure/Azurite
Issue simili
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Japan Fact 898 (good-first-issue)Apertacommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
lingdojo/kana-dojo#33145 · 1 commento · 5 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
code-yeongyu/senpi#4278 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug] Activity | The activity list ignores taskIds and returns the activities of every taskForse già presa @NdekoCode l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ever-co/ever-gauzy#11469 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
griffinwork40/agent-afk#4408 ·
I maintainer di solito rispondono entro 1 giorno