temporalio / temporalio/samples-java

[Bug] moneybatcher sample race condition?

Đang mở
#749 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

bug
Ngôn ngữ chính
Java
Star
258
Fork
189
Merge trung bình
6 ngày 4 giờ
Pull request đã merge (30 ngày)
4

Mô tả

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

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với moneybatch sample trong core/src/main/java/io/temporal/samples/moneybatch và chạy TransferWorkflowTest từ branch tái hiện được liên kết. Kiểm tra điều kiện Workflow.await và thiết lập kiểm thử cho các yêu cầu vượt quá kích thước của một batch. Được xem là hoàn tất khi workflow được tái hiện hoàn thành và xử lý các batch mong đợi thay vì tiếp tục bị chặn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
distributed-systems
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.