Skip to content

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

@stiwari99

Description

@stiwari99

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions