Conversation
87f8fbd to
a308a1f
Compare
30cbdc9 to
50171eb
Compare
|
This PR causes There are 4 things going on:
Before, we explicitly completed the result before returning from the channel builder, so the completion order was [result,channel]. Now, we return from the async builder to complete the result, and then close the state channel as a side effect of emitting result. However, emitting result actually has another side effect – Since we’re using the However, since this is all happening synchronously, the first completion handler hasn’t returned yet, so the second completion handler (which removes the workflow from the map), hasn’t run. So when the re-entrant call to Ultimately I think the root cause here is that there’s a race between delivering the result to the parent and seeing the child as “finished”. I knew that race was there, but didn’t expect it to show up like this (figured it would only bite us if we tried using multiple threads). I believe the fix is to change |
e19bdad to
a60c653
Compare
a60c653 to
c74a61a
Compare
…ment Reactor in terms of it. This allows different implementations of workflows besides the state-value-for-loop that is Reactor. For example, a unit test could create a stub workflow that sends a specific sequence of states.
50171eb to
d0aef29
Compare
|
Fixed the |
| try { | ||
| events.offer(event) | ||
| } catch (e: ClosedSendChannelException) { | ||
| // This may mean the workflow was canceled or finished, or that the workflow closed the |
There was a problem hiding this comment.
I wonder how often we'll find ourselves crashing due to late events being aimed at a finished workflow. Hopefully those will be actual bugs, not something we'll need to become more forgiving about. (Not suggesting any changes, just chatting.)
This allows different implementations of workflows besides the state-value-for-loop that is
Reactor. For example, a unit test could create a stub workflow that sends a specific sequence of states.