Corrupted overlaybd.commit contains duplicated blocks and stalls TCMU / Pod sandbox creation

Abierto
#471 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
56/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
cpp, linux
Área
backend

Línea de trabajo

Start with BkDownload::download_blob() in src/bk_download.cpp and trace how src->pread() results affect buffer writes and offset updates. Add a focused test that injects zero and short positive reads while bytes remain; done means unread buffer contents are never written or accepted as downloaded data. The issue reports no deterministic end-to-end reproducer.

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

Descripción

bug
What happened in your environment?

We intermittently see a node stop creating Pod sandboxes. On one occasion, a Pod retried sandbox creation more than 2,000 times over approximately seven hours. OverlayBD TCMU reported repeated CRC errors. Snapshot cleanup was stuck in unlinkat() while removing a TCMU configfs LUN link, and containerd goroutines attempting to prepare snapshots were blocked on a metadata snapshotter lock. The “sandbox name is reserved” errors were part of the resulting failure chain: an earlier RunPodSandbox attempt had reserved the name before getting stuck during snapshot preparation, so subsequent attempts using the same name were rejected by containerd.

We traced one affected snapshot to a corrupted local overlaybd.commit. overlaybd-zfile --verify reported checksum/CRC failures:

pread:checksum verification failed after retries
zfile_validation_check:crc check error in block 203963

We downloaded the corresponding layer independently and compared it with the local file. The file size was 663,820,800 bytes. Exactly nine 256 KiB chunks differed. Each bad chunk was an exact copy of an earlier chunk:

Local chunk 2038 == reference chunk 2037
Local chunk 2039 == reference chunk 2037
Local chunk 2129 == reference chunk 2128
Local chunk 2147 == reference chunk 2146
Local chunk 2184 == reference chunk 2183
Local chunk 2241 == reference chunk 2240
Local chunk 2320 == reference chunk 2319
Local chunk 2339 == reference chunk 2338
Local chunk 2464 == reference chunk 2463

In the current upstream BkDownload::download_blob() implementation, a negative src->pread() result is retried, but a zero or short positive result is accepted. The code then writes count bytes from the buffer and advances the offset by count. If fewer than count bytes were read, this appears capable of writing stale buffer contents. The observed duplicated chunks are consistent with that failure mode, but we did not capture the actual pread() return values during the incident.

We have observed the same pattern in multiple incidents: many corrupted blocks are exact copies of valid blocks. This closely resembles the failure mode described above for a zero-length pread() result, although we have not captured such a return value directly. Could the pread() return-value handling be hardened to prevent an empty read from writing stale buffer contents and potentially leaving the entire node unable to create PodSandboxes?

What did you expect to happen?
  • A zero or short read before the expected end of the source should be handled explicitly; unread buffer bytes should never be written as valid downloaded data.

  • A corrupted local committed layer should not continue to be used without detection or recovery.

  • Snapshot/device cleanup should not remain blocked indefinitely after the underlying read failure.

How can we reproduce it?

The production failure is intermittent; we do not yet have a deterministic end-to-end reproducer. A focused test for the suspected downloader issue would inject a zero or short positive return from src->pread() while bytes remain and verify that no stale buffer data is written or accepted.

What is the version of your Overlaybd?
  • OverlayBD version/commit: 1.0.16

  • OverlayBD snapshotter version/commit: 1.4.3

  • containerd version: 2.1.6

  • Linux distribution and kernel: anolis os 5.10.134-16.3.al8.x86_64

What is your OS environment?

anolis 8

Are you willing to submit PRs to fix it?
  • Yes, I am willing to fix it.
Lenguaje dominante
C++
Estrellas
447
Forks
102
Merge medio
1 d 7 h
PR fusionados (30 d)
8

Preparar el entorno

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 containerd/overlaybd

Todos los issues de containerd/overlaybd

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.