Activities still running after workflow is terminated

Hey Temporal team,

I created a simple workflow that creates and calls an activity that runs a while(true) loop which writes logs like so:

public void testLoop() {
    do {
        try {
            LOGGER.info("Still running activity");
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            throw new RuntimeException("Interrupted while sleeping between requests.", e);
        }
    } while (true);
}

When I terminate the workflow in the Temporal UI, it seems the activity is still running and logging. Shouldn’t the activity be terminated (similar to how child workflows are terminated when their parents are)? Or am I missing something when I created the activity stub?

Edit: Forgot to mention, scheduled timeouts are also not being respected. I set the .setStartToCloseTimeout for 5 minutes for the activity and it was still logging after the timeout period.

PS. I think the javadoc needs to be updated for ActivityCancellationType since it refers to workflows still (copied from ChildWorkflow cancellation I assume)

Thanks!

1 Like

When I terminate the workflow in the Temporal UI, it seems the activity is still running and logging.

Can I ask you to clarify if you mean the web UI or the CLI? AFAIK the webUI is readonly as of today.

As for the java docs, thanks for the heads up. I made sure to let our content guy know they need to be updated.

Ah sorry, I’ll clarify. I’m terminating the workflow in the webUI (the big red Terminate button).

I’m seeing the logs in our k8s pod, ex:
textPayload: "22:00:23,145 [TestActivityImpl] (Activity Executor taskList=activity.TestActivity", namespace="default": 1) INFO - Still running activity

textPayload:"22:00:26,145 [TestActivityImpl] (Activity Executor taskList="activity.TestActivity", namespace="default": 1) INFO - Still running activity

Currently, the only way an activity can learn about its cancellation or workflow completion is through the heartbeat. As your activity is not heartbeating it will run until its method returns.

2 Likes

Excellent! Thanks for clearing it up.

Did a reread of heartbeats here for anyone else curious.

I was also wondering if this issue created in the Go-SDK can be made in the java-SDK as well @maxim?

We will make sure that we implement this feature in all the current and future SDKs.

1 Like