temporalio / temporalio/samples-java
[Bug] moneybatcher sample race condition?
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 258
- Fork
- 189
- Merge medio
- 6g 4h
- PR unite (30g)
- 4
Descrizione
What are you really trying to do?
I am trying to learn how to do batching using temporal. I found the moneybatch sample and I wanted to make sure that it can handle requests in parallel.
To simulate the behavior, I changed the workflow to withdraw more times than a single batch size as well as added a delay during the deposit call.
What this lead to is that the workflow would continue to run and not complete, it won't even process a single batch.
Describe the bug
This is related to the condition in the workflow:
Workflow.await(() -> count == batchSize);
If count suddenly goes from 0 to a value greater than batchSize, the workflow will continue to run and not complete.
I am new to temporal, so I am not quite sure how to fix this. Is this a bug in the sample or am I doing something wrong?
Minimal Reproduction
Download this branch:
https://github.com/derwasp/samples-java/tree/derwasp/moneybatcher
Either run ./run-moneybatch-demo.sh and observe the logs.
Or run the test TransferWorkflowTest and see the failure.
Environment/Versions
- OS and processor: M4 Mac
- Temporal Version: (CLI version 1.4.1)
- Are you using Docker or Kubernetes or building Temporal from source? Docker
Additional context
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.
Direzione di ricerca
Inizia con il moneybatch sample in core/src/main/java/io/temporal/samples/moneybatch ed esegui TransferWorkflowTest dal branch di riproduzione collegato. Esamina la condizione di Workflow.await e la configurazione del test per le richieste che superano la dimensione di un batch. Il lavoro è concluso quando il workflow riprodotto termina ed elabora i batch previsti invece di rimanere bloccato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- distributed-systems
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100