Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

ETag and Bytes discrepancy with a Put Block List replacing the same Block Blob

Abierto
#2,845 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@bxrne ya está trabajando en esto.

Desde el 13/10/2026.

  • #2846 de @bxrne — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nodejs, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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:

  1. Commit v1 of a Block Blob.
  2. Call downloadBlob.
  3. Commit v2.
  4. Check that the downloaded model still has v1's ETag, content length and block list, and that a new downloadBlob returns v2.

Without the fix the test fails with 'etag-v2' !== 'etag-v1'.

Lenguaje dominante
TypeScript
Estrellas
2.3k
Forks
399
Merge medio
1 d 4 h
PR fusionados (30 d)
30

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Azure/Azurite

Todos los issues de Azure/Azurite

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.