temporalio / temporalio/samples-java
[Bug] moneybatcher sample race condition?
Personne n'a encore pris cette issue.
- Langage dominant
- Java
- Étoiles
- 258
- Forks
- 189
- Merge moyen
- 6 j 4 h
- PR mergées (30 j)
- 4
Description
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
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le moneybatch sample dans core/src/main/java/io/temporal/samples/moneybatch et exécutez TransferWorkflowTest depuis la branche de reproduction liée. Examinez la condition de Workflow.await et la configuration du test pour les requêtes dépassant la taille d’un batch. Le travail est terminé lorsque le workflow reproduit s’achève et traite les batches attendus au lieu de rester bloqué.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java
- Domaine
- distributed-systems
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100