# Possible race condition between signalWithStart and continueAsNew?

**URL:** <https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733>\
**Category:** Community Support\
**Tags:** signals, typescript-sdk\
**Created:** [December 15, 2022, 10:50am UTC](https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733 "2022-12-15T10:50:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhecking](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jhecking/32/4045_2.png) [@jhecking](https://community.temporal.io/u/jhecking)\
**Post date:** [December 15, 2022, 10:50am UTC](https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733/1 "2022-12-15T10:50:03Z")

</div>

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…)

---

<div class="post-metadata">

**Author:** ![bergundy](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/bergundy/32/900_2.png) [@bergundy](https://community.temporal.io/u/bergundy)\
**Post date:** [December 15, 2022, 4:51pm UTC](https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733/2 "2022-12-15T16:51:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jhecking](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jhecking/32/4045_2.png) [@jhecking](https://community.temporal.io/u/jhecking)\
**Post date:** [December 15, 2022, 10:39pm UTC](https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733/3 "2022-12-15T22:39:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chandler\_Gonzales](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/chandler_gonzales/32/3099_2.png) [@Chandler\_Gonzales](https://community.temporal.io/u/Chandler_Gonzales)\
**Post date:** [December 16, 2022, 5:41pm UTC](https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733/4 "2022-12-16T17:41:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [December 16, 2022, 5:42pm UTC](https://community.temporal.io/t/possible-race-condition-between-signalwithstart-and-continueasnew/6733/5 "2022-12-16T17:42:27Z")

</div>

Yes, same would apply, no signals are lost.
