Work inside the handler invocations and Context.run() calls is not interrupted when invocations are aborted
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Ambito
- backend, distributed-systems
Direzione di ricerca
Inizia confrontando l’implementazione Kotlin HandlerRunner con la gestione di onClosedInvocationStreamHook di Java HandlerRunner. Segui il percorso dell’executor fino a ContextImpl e le chiamate a Context.run(), quindi verifica che il lavoro in esecuzione negli handler venga interrotto dopo la chiusura di un invocation stream dovuta a un abort. L’issue non indica file o test specifici.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hey there. I was testing restate sdk using java and noticed that work inside the handlers was still being performed long after restate server aborted the invocations (abort timeout reached). I noticed that HandlerRunner for kotlin has an implementation that cancels work using onClosedInvocationStreamHook, but java implementation for HandlerRunner ignores onClosedInvocationStreamHook. Is this intentional?
If not, 2 solutions come to mind:
- Keep a collection of threads which are doing work by registering thread's reference inside the executor calls:
**initialize worker thread references collection here**
**set onClosedInvocationStreamHook to iterate over the worker threads and interrupt them here**
options.executor.execute(
() -> {
HANDLER_CONTEXT_THREAD_LOCAL.set(handlerContext);
try (Scope ignored =
handlerContext.request().openTelemetryContext().makeCurrent()) {
**add thread's ref to collection here**
runnable.run();
} finally {
**remove thread's ref from collection here**
HANDLER_CONTEXT_THREAD_LOCAL.remove();
}
});
- Require ExecutorService instead of Executor when setting up the handler options, so that ExecutorService.submit(...) method is used instead of Executor.execute(...) and the output Futures can be collected and used to interrupt the worker threads when onClosedInvocationStreamHook is called (Future has cancel method which can interrupt thread). However, I see that Executor is passed down to ContextImpl so this change could propagate beyond HandlerRunner's scope. Maybe an adapter between ExecutorService and Executor can be made to limit the scope (ExecutorService wrapped by Executor which is passed into ContextImpl, when Executor.execute is called, the call is delegated to ExecutorService.submit and the resulting Futures are collected inside HandlerRunner)
- Lingua principale
- Java
- Stelle
- 60
- Fork
- 17
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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 restatedev/sdk-java
-
Vert.x 5 update Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
restatedev/sdk-java#629 · 2 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
restatedev/sdk-java#614 · 2 commenti ·
-
Reflection based experience Aperta
restatedev/sdk-java#570 · 1 assegnatario ·
-
dependencies
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
restatedev/sdk-java#569 · 2 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
restatedev/sdk-java#555 · 1 commento ·
Tutte le issue di restatedev/sdk-java
Issue simili
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/rocketmq-dashboard#5064 ·