Redesign AsyncioWaker around caller-context-independent state transitions
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Refactoring
- Chiarezza
- Da chiarire
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- backend, testing-qa
Direzione di ricerca
Start with src/future/asyncio/waker.rs and the runtime attachment check in src/utils.rs, then run the subprocess regressions in python/tests/test_deadlocks.py. Agree on the state-machine design before implementation; done means the listed wake, callback, shutdown, finalization, and subprocess tests define correct behavior without public Python API changes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem and proposed change
AsyncioWaker connects Rust future wakeups to an asyncio.Future. A mutex-protected slot records whether the coroutine is idle, was woken before parking, or is parked on a Python future.
A Rust future can wake:
- synchronously while Python is polling it; or
- later from a detached Tokio worker.
The standard Wake trait does not report which context called it. Current code therefore detects attachment at runtime. Parking also invokes Python event-loop methods while holding the slot mutex. These assumptions make lock ordering, shutdown, and interpreter finalization difficult to reason about.
Redesign the state machine so the mutex protects only short state transitions and ownership moves. Release the mutex before calling Python or destroying Python-owned values. Make wake_by_ref work without detecting caller attachment.
Agree on the design first, then implement it separately.
Context
Current slot states and parking path:
Current explicit wake methods and mixed-context Wake implementation:
Current runtime attachment check:
Existing subprocess regressions:
The same-thread re-entry report #212 was closed as not planned. This proposal is broader structural hardening, not an automatic reopening:
https://github.com/scylladb/python-rs-driver/issues/212
An unconditional Python attachment on every worker wake could hurt performance. Related investigation:
https://github.com/scylladb/python-rs-driver/issues/179
Acceptance criteria
- The slot guard protects only state transitions and ownership moves.
- Python calls and Python-owned-value destruction occur after unlocking.
wake_by_refdoes not need to detect caller attachment.- Wake before, during, and after parking remains correct.
- Tests cover synchronous self-wake and detached worker wake.
- Tests cover callback completion, close, cancel, and exception delivery.
- Task destruction and runtime shutdown behavior are defined.
- Interpreter-finalization behavior is defined if any fallback attaches.
- Potential hangs run in subprocesses with external watchdogs.
- Tests detect lost and duplicate wakeups.
- The worker fast path does not gain unconditional Python attachment without an explicit performance decision.
- No public Python API changes.
- Lingua principale
- Rust
- Stelle
- 6
- Fork
- 8
- Merge medio
- 5g 18h
- PR unite (30g)
- 13
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 scylladb/python-rs-driver
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
scylladb/python-rs-driver#224 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
scylladb/python-rs-driver#193 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
scylladb/python-rs-driver#158 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 59/100
scylladb/python-rs-driver#235 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
scylladb/python-rs-driver#233 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di scylladb/python-rs-driver
Issue simili
-
area::tern-sync kind::cleanup triage::ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
review-bot
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
midagedev/bloomery#160 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
oxidecomputer/humility#737 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno