Abort the in-flight dataset open when a worker drops

Aperta
#482 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
54/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
rust

Direzione di ricerca

Start with beacon-db/beacon-file-formats/beacon-nd-array/src/arrow/morsel.rs, especially Worker::prefetch, Worker::take, and the existing a_worker_waits_for_a_file_another_is_still_opening test. Trace how the opening counter changes when an open task is cancelled, then add coverage that drops a worker during an open and verifies the other workers finish. Done means cancellation stops the open task and the counter does not leave workers waiting indefinitely.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug effort-S nd-pipeline rust

Parent: #481

Describe the bug

Worker::prefetch starts a dataset open with tokio::spawn. The worker keeps the JoinHandle.

The Worker struct has no Drop implementation. Tokio detaches a task when the code drops its handle.

A client cancels a query. Every worker drops. Up to target_partitions open tasks then run to the end.

Each task opens a collection. It reads the footer, the layouts and the attributes. It registers the result into a MorselSource. No worker reads that result.

Impact

The work is bounded. Each worker leaks one open, and then the tasks stop.

The cost is late cancellation and wasted I/O.

Expected behavior

A cancelled query stops every open task.

Suggested fix

  1. Add a Drop implementation to Worker.
  2. Call abort() on self.next in it.
  3. Keep the opening counter correct.

Step 3 is not optional. Read the code first.

prefetch raises opening before the spawn. The task lowers it at the end. An abort skips that lower step. The counter then stays above zero.

Worker::take reads opening to decide that the scan is over. See morsel.rs:435. A stale counter makes a worker wait for a notify that never arrives.

One partition can drop its stream alone. A LIMIT does this. So the hang reaches a query that the client still reads.

Move the counter decrement out of the task body. Use a guard type that lowers the counter on drop.

File

beacon-db/beacon-file-formats/beacon-nd-array/src/arrow/morsel.rs

Scope

Every nd format reads through MorselSource. netCDF, HDF5, Zarr and Atlas share this path.

Test

The test a_worker_waits_for_a_file_another_is_still_opening covers the wait path. Add a test that drops a worker during an open. Assert that the other workers finish.

Lingua principale
Rust
Stelle
16
Fork
4
Merge medio
19h 58m
PR unite (30g)
39

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di maris-development/beacon

Tutte le issue di maris-development/beacon

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.