temporalio / temporalio/samples-java

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

Offen
#326 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug
Vorherrschende Sprache
Java
Sterne
258
Forks
189
Ø Merge
6 T. 4 Std.
Gemergte PRs (30 T.)
4

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Vergleiche die main-Methode von HelloCancellationScope mit HelloCancellationScopeTest und führe beide Abläufe anhand der Beispielausgaben im Issue erneut aus. Verfolge, wie sich die zuerst abgeschlossene Aktivität auf die verbleibenden Aktivitäten auswirkt, und betrachte das Issue als gelöst, wenn die Test- und die main-Ausführung konsistent das beabsichtigte Abbruchverhalten zeigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.