Audit GrpcFuture cancellation
- Lingua principale
- Java
- Stelle
- 12.1k
- Fork
- 4k
- Merge medio
- 2g 17h
- PR unite (30g)
- 37
Descrizione
GrpcFuture is currently using an `interruptTask()` override to cancel the RPC. This doesn't appear to be correct, as it is only called when `cancel(true)` is invoked on the outer Future. There are a few problems with this:
1. The Future's cancellation is not atomically set with the calls. If any callbacks start while the future is still cancelling, they may see the call is not yet closed.
2. The call is only cancelled when true is set. This appears to be an incorrect interpretation of `mayInterruptIfRunning`, which is intended for tasks on an ExecutorService. This is also different than internal RPC implementations
3. interruptTask() is bordering on being deprecated, and may not be available in the future
4. Futures can be cancelled from any thread, but ClientCall.cancel is not thread safe.
cc: @lukesandberg
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia individuando GrpcFuture e il suo override di interruptTask(), quindi esamina come la cancellazione interagisce con il ClientCall sottostante e con le callback. Confronta il comportamento con le implementazioni RPC interne menzionate nell’issue; il lavoro è completato quando la cancellazione viene gestita in modo coerente per entrambi i flag di cancel() e in modo sicuro da qualsiasi thread.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- api, distributed-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100