temporalio / temporalio/samples-java

[Bug] SlidingWindowBatchWorkflowImpl.java recived signals are getting ignored if currentRecords is empty

Open
#510 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
258
Forks
189
Avg merge
6d 4h
Merged PRs (30d)
4

Description

What are you really trying to do?
Describe the bug

If signal is received when currentRecords is empty instead of null then it will not add it to recordsToRemove list which is causing Workflow.await(() -> currentRecords.size() == 0); to wait indefinite
https://github.com/temporalio/samples-java/blob/main/core/src/main/java/io/temporal/samples/batch/slidingwindow/SlidingWindowBatchWorkflowImpl.java#L130

Current Code

 if (currentRecords == null) {
      recordsToRemove.add(recordId);
      return;
    }

Expected change

 if (currentRecords == null || currentRecords.isEmpty()) {
      recordsToRemove.add(recordId);
      return;
    }
Minimal Reproduction
Environment/Versions
  • OS and processor: [e.g. M1 Mac, x86 Windows, Linux]
  • Temporal Version: [e.g. 1.14.0?] and/or SDK version
  • Are you using Docker or Kubernetes or building Temporal from source?
Additional context

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at core/src/main/java/io/temporal/samples/batch/slidingwindow/SlidingWindowBatchWorkflowImpl.java around line 130 and inspect how received signals are handled when currentRecords is empty. Verify that the record ID is added to recordsToRemove and that Workflow.await can complete instead of waiting indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.