Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When evicting workflows from cache make sure all go routines are evicted serially #1718

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

When evicting workflows from cache make sure all go routines are evicted serially.

@Quinn-With-Two-Ns Quinn-With-Two-Ns marked this pull request as ready for review November 25, 2024 18:53
@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner November 25, 2024 18:53
}
// We need to make sure the coroutine is closed, otherwise we risk concurrent coroutines running
// at the same time causing a race condition.
<-s.aboutToBlock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this accomplish the comment above? If we receive a signal from aboutToBlock we exit cleanly, and otherwise if the timer fire first, why do we send a signal to aboutToBlock when the timer expires?

Is it just to trigger the next coroutine exiting that it can exit cleanly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't send a signal to aboutToBlock, we wait on receiving a signal from aboutToBlock, which is sent on exit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, misread this statement as sending a signal.. thanks for clarifying. So this function's behavior is the same, with an added log statement on timeout.

I'm a little confused by the PR title, this seems more like adding logs to help identify if evicted co-routines are timing out/exiting in the same order, but there is no code to actually make sure this is happening?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It behaves a bit differently because previously we didn't have this second <-s.aboutToBlock to if the coroutine didn't exit fast enough we would end up evicting multiple coroutines in parallel. Now we always wait for <-s.aboutToBlock to fire before we continue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right.. Maybe I need more coffee.. thanks for clarifying!

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit cac9321 into temporalio:master Nov 26, 2024
13 checks passed
ReyOrtiz pushed a commit to ReyOrtiz/temporal-sdk-go that referenced this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants