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

Evict the workflow from cache if their is a panic in the SDK #1654

Merged

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Evict the workflow from cache if their is a panic in the SDK. previously if their was some panic in the SDK code the SDK would not evict the workflow from cache and leave the workflow in a potentially bad state

@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner October 2, 2024 19:08
tagPanicError, fmt.Sprintf("%v", p),
tagPanicStack, st)
taskErr = newPanicError(p, st)
err = taskErr
Copy link
Member

Choose a reason for hiding this comment

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

doesn't this refer to the err on line 382?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

err refers to the named return . Otherwise the test would fail.

Copy link
Member

Choose a reason for hiding this comment

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

oh right, 382 reuses and doesn't shadow err.. I kind of hate that feature of go :( separate names would make it more clear

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good point, idk why I didn't give it a different name.

@cretz
Copy link
Member

cretz commented Oct 3, 2024

Pardon my ignorance here, but how is eviction performed on task failure today unrelated to this panic specifically? Is it the next time the task is received the cached workflow is determined invalid?

@Quinn-With-Two-Ns
Copy link
Contributor Author

but how is eviction performed on task failure today unrelated to this panic specifically

We rely on ProcessWorkflowTask returning an error if processing the workflow task fails. If we unlock the context with an error it is evicted

@cretz
Copy link
Member

cretz commented Oct 3, 2024

Still a bit lost (sorry, trying to avoid code). So today eviction occurs when on panic? And after this PR when will it happen? Or are you saying eviction was not occurring on this panic and the cached value was reused even post-panic? Meaning your test here would have failed?

@Quinn-With-Two-Ns
Copy link
Contributor Author

you saying eviction was not occurring on this panic and the cached value was reused even post-panic? Meaning your test here would have failed?

Yes, eviction was not occurring on panics in the SDK code. Panics in users workflows are translated to errors that are being evicted.

@Quinn-With-Two-Ns Quinn-With-Two-Ns merged commit ea60ad5 into temporalio:master Oct 3, 2024
13 checks passed
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