Skip to content

Throw clear error if workflow stub is misused #2543

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Quinn-With-Two-Ns
Copy link
Contributor

Throw clear error if workflow stub is misused

closes #746

@Quinn-With-Two-Ns Quinn-With-Two-Ns requested a review from a team as a code owner June 3, 2025 15:36
@@ -13,6 +13,13 @@ final class ActivityStubImpl extends ActivityStubBase {
private final WorkflowOutboundCallsInterceptor activityExecutor;
private final Functions.Proc assertReadOnly;

private void assertSameWorkflow() {
if (activityExecutor != WorkflowInternal.getWorkflowOutboundInterceptor()) {
throw new IllegalStateException(
Copy link
Member

Choose a reason for hiding this comment

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

What happened before this code was added? Did things work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the linked issue, it would be some cryptic error message

        io.temporal.failure.ApplicationFailure: message='Operation allowed only while eventLoop is running', type='java.lang.IllegalStateException', nonRetryable=false

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.

Reuse of ActivityStubs from another workflow should produce a usable diagnostic or be allowed
2 participants