temporalio / temporalio/samples-java

[Bug] moneybatcher sample race condition?

オープン
#749 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Java
スター
258
フォーク
189
平均マージ
6日 4時間
マージ済み PR(30日)
4

説明

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?

Image Image
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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

core/src/main/java/io/temporal/samples/moneybatch の moneybatch sample から始め、リンクされた再現ブランチで TransferWorkflowTest を実行します。Workflow.await の条件と、1 batch サイズを超えるリクエストに対するテスト設定を調査します。再現した workflow が完了し、ブロックされたままにならずに期待される batch を処理すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
distributed-systems
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。