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

[Bug] HelloCancellationScope example has different behaviour when running the test vs when running the workflow through the main method #326

Open
antmendoza opened this issue Jul 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@antmendoza
Copy link
Member

What are you really trying to do?

I am trying to understand how cancellation scopes work, and for that I am looking at HelloCancellationScope and HelloDetachedCancellationScope

Describe the bug

I was looking at the code in the HelloCancellationScope class.

If I run the example through the main method, this is the output:

Activity for Oi going to take 23 seconds
Activity for Привет going to take 8 seconds
Activity for Hallo going to take 16 seconds
Activity for Bye going to take 28 seconds
Activity for Hola going to take 11 seconds
Activity for Hello going to take 19 seconds
Activity for Привет completed
Activity for Oi was cancelled. Cleanup is expected to take 2 seconds.
Activity for Hallo was cancelled. Cleanup is expected to take 4 seconds.
Activity for Bye was cancelled. Cleanup is expected to take 1 seconds.
Activity for Hola was cancelled. Cleanup is expected to take 2 seconds.
Activity for Hello was cancelled. Cleanup is expected to take 1 seconds.
Activity for Bye finished cancellation
13:26:44.374 {HelloCancellationScopeWorkflow dd9e08dd-9b26-3f67-a226-396d0fa9c2df} [Activity Executor taskQueue="HelloCancellationScopeTaskQueue", namespace="default": 4] INFO  i.t.i.a.ActivityTaskExecutors$ActivityTaskExecutor - Activity canceled. ActivityId=dd9e08dd-9b26-3f67-a226-396d0fa9c2df, activityType=ComposeGreeting, attempt=1 
Activity for Hello finished cancellation
13:26:44.387 {HelloCancellationScopeWorkflow be5eaced-ee7f-34ee-9e18-1bc0de1bc344} [Activity Executor taskQueue="HelloCancellationScopeTaskQueue", namespace="default": 6] INFO  i.t.i.a.ActivityTaskExecutors$ActivityTaskExecutor - Activity canceled. ActivityId=be5eaced-ee7f-34ee-9e18-1bc0de1bc344, activityType=ComposeGreeting, attempt=1 
Activity for Oi finished cancellation
13:26:45.355 {HelloCancellationScopeWorkflow 42c07d6b-7f8d-3638-b408-6045e5eee15d} [Activity Executor taskQueue="HelloCancellationScopeTaskQueue", namespace="default": 1] INFO  i.t.i.a.ActivityTaskExecutors$ActivityTaskExecutor - Activity canceled. ActivityId=42c07d6b-7f8d-3638-b408-6045e5eee15d, activityType=ComposeGreeting, attempt=1 
Activity for Hola finished cancellation
13:26:45.383 {HelloCancellationScopeWorkflow 7c33e886-500d-3711-8d81-8c0d84d6291e} [Activity Executor taskQueue="HelloCancellationScopeTaskQueue", namespace="default": 5] INFO  i.t.i.a.ActivityTaskExecutors$ActivityTaskExecutor - Activity canceled. ActivityId=7c33e886-500d-3711-8d81-8c0d84d6291e, activityType=ComposeGreeting, attempt=1 
Activity for Hallo finished cancellation
13:26:47.366 {HelloCancellationScopeWorkflow b1ec9997-52bc-3c81-8a4c-2be9f2506e41} [Activity Executor taskQueue="HelloCancellationScopeTaskQueue", namespace="default": 3] INFO  i.t.i.a.ActivityTaskExecutors$ActivityTaskExecutor - Activity canceled. ActivityId=b1ec9997-52bc-3c81-8a4c-2be9f2506e41, activityType=ComposeGreeting, attempt=1 
Привет World!

After the first activity is completed all the remaining activities are cancelled as expected.

If I run the test (HelloCancellationScopeTest), this is the output:

Activity for Hello going to take 9 seconds
Activity for Hola going to take 16 seconds
Activity for Bye going to take 9 seconds
Activity for Hallo going to take 11 seconds
Activity for Привет going to take 8 seconds
Activity for Oi going to take 16 seconds
Activity for Привет completed
Activity for Bye completed
Activity for Hello completed
Activity for Hallo completed
Activity for Hola completed
Activity for Oi completed

After the first activity is completed all the remaining activities are not cancelled.

Minimal Reproduction

Environment/Versions

  • OS and processor: [e.g. M1 Mac, x86 Windows, Linux]
  • Temporal Version: [e.g. 1.14.0?] and/or SDK version
  • Are you using Docker or Kubernetes or building Temporal from source?

Additional context

@antmendoza antmendoza added the bug Something isn't working label Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant