temporalio / temporalio/samples-java

[Bug] moneybatcher sample race condition?

未关闭
#749 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
Java
星标
258
派生
189
平均合并
6 天 4 小时
30 天内合并 PR
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. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 core/src/main/java/io/temporal/samples/moneybatch 下的 moneybatch sample 开始,并从链接的复现分支运行 TransferWorkflowTest。检查 Workflow.await 条件,以及针对超过一个 batch 大小的请求的测试设置。完成标准是复现的 workflow 能够完成并处理预期的 batches,而不是一直处于阻塞状态。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
distributed-systems
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。