Query cancellation leaks tasks and loses metrics
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- rust
- Ambito
- backend, distributed-systems
Direzione di ricerca
Start with the three sub-issues: #482 for task cleanup in beacon-db/beacon-file-formats/beacon-nd-array/src/arrow/morsel.rs, #483 for pruning in beacon-db/beacon-file-formats/beacon-arrow-atlas/src/datafusion/pruning.rs, and #484 for metrics in beacon-db/beacon-core/src/runtime.rs. Read the linked sub-issue for the chosen problem; #484 first needs a decision on how to represent partial metrics. Done means addressing that sub-issue’s cancellation behavior and validating it with its relevant tests.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
A client cancels a query when it disconnects. The scan stops. Three problems remain.
Nothing wraps the query in a tokio::spawn. So cancellation depends on the drop of the handler future.
Problem 1. Dataset opens continue after cancellation. #482
Worker::prefetch starts each dataset open with tokio::spawn. The worker holds the JoinHandle.
This path has no Drop implementation. Tokio detaches a task when the code drops its handle. So up to target_partitions opens run to the end. Each one registers into a MorselSource that no worker reads.
File: beacon-db/beacon-file-formats/beacon-nd-array/src/arrow/morsel.rs
Problem 2. The pruning index build does not stop. #483
candidate_filter builds the index on tokio::task::spawn_blocking. Tokio cannot cancel a blocking task. The blocking pool runs it to the end.
A large collection commits real CPU time to a query that no client reads.
File: beacon-db/beacon-file-formats/beacon-arrow-atlas/src/datafusion/pruning.rs
Problem 3. A cancelled query records no metrics. #484
The stream output records metrics at stream end. A cancelled query never reaches that point. The query store then holds no row for it. The atlas_* counters are lost too.
A slow query that a client abandons leaves no trace. These queries need diagnosis the most.
File: beacon-db/beacon-core/src/runtime.rs
Expected behavior
- A cancelled query stops every task it started.
- A cancelled query records the metrics it collected.
More context
The two output routes cancel differently.
The stream output holds a lazy stream in the response body. A disconnect drops the body. The drop reaches the scan. The scan stops. This route works well.
The file output runs to the end inside run_query. It drains the whole COPY TO before the server sends any byte. No write fails in that time. So the server detects the disconnect late.
File: beacon-server/beacon-server/src/axum/client/query.rs
Suggested fix
Each problem has its own issue. See the sub-issue list above.
- #482 aborts the open task on drop.
- #483 stops the pruning index build.
- #484 records the metrics of a cancelled query.
Items 1 and 2 are independent.
Item 3 needs a decision first. Mark the row as partial, or add a state column.
Scope
Problem 1 affects every nd format. netCDF, HDF5, Zarr and Atlas all read through MorselSource.
Problem 2 affects Atlas only.
Problem 3 affects every stream query.
- 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
- 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 maris-development/beacon
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
maris-development/beacon#704 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
maris-development/beacon#681 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort-S python
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
maris-development/beacon#494 ·
I maintainer di solito rispondono entro 1 giorno
-
bug effort-S tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
maris-development/beacon#493 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
maris-development/beacon#687 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di maris-development/beacon
Issue simili
-
autofix:working
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
libracoder/kiri#1138 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
roc-lang/basic-webserver#277 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
samkerrcode/opengent#113 ·
I maintainer di solito rispondono entro 1 giorno
-
app bug session
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno