Possible race condition between signalWithStart and continueAsNew?

We have a workflow to process incoming events, which clients submit using signalWithStart. The workflow is intended to run continuously, waiting for new signals to process. At some point, the workflow needs to use continueAsNew to avoid running into the workflow history limit. Is there any chance of a race condition where signalWithStart will start a new workflow run after the current workflow run has completed, but before the new workflow run triggered by continueAsNew has started?

Both the workflow worker and the client are using the Temporal Node.js SDK in case that matters. (I assume it doesn’t…)

Temporal eliminates this race and forces the workflow to rewind and replay to include the last signal if it arrives while a workflow task is being processed where the code decides to complete the execution.

Great! That’s what I expected, but good to get confirmation.

Does this rewind behavior apply to workflows that complete without continueAsNew too?

Yes, same would apply, no signals are lost.

1 Like