External Task High CPU usage

even if there are no tasks running, it is still this phenomenon
Is there a way to reduce the frequency?

This phenomenon can occur by simply referencing the following dependencies

org.camunda.bpm.springboot
camunda-bpm-spring-boot-starter-external-task-client

The following image was detected using Arthas tool

Hello,

We are having exactly the same issue after including the camunda-bpm-spring-boot-starter-external-task-client dependency. Also, although we defined the @ExternalTaskSubscription handlers, the list of subscriptions on the TopicSubscriptionManager.acquired call is always an empty array.

This really seems to be a problem with the library itself. Can we get some help on this?

@Ingo_Richtsmeier
Do you have any good ideas?

Hi @yulinyang,

I don’t have any real clue what is going on there.

Does it happen on other computers as well?

How is the external task client configured?

If the backoff-strategy is disabled without enabling long polling, you may run an endless loop without any interrupts. That may cause a high CPU load.

Hope this helps, Ingo

I have tested on multiple different machines and will reproduce this issue.
I didn’t disable the backoff-strategy, the disable-backoff-strategy uses default values (false).
How to enable long polling? Using REST API to obtain external tasks?

Hi @yulinyang,

How do you connect to the process engine?

You have to configure the async-response-timeout in the spring-boot-config file: External Task Client Spring Boot Starter | docs.camunda.org

Could you share your spring-boot config file?

Hope this helps, Ingo

Hi, @Ingo_Richtsmeier ,

// Sever(Spring boot): 
<dependency>
  <groupId>org.camunda.bpm.springboot</groupId>
  <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
</dependency>
// External Task Client:
<dependency>
  <groupId>org.camunda.bpm.springboot</groupId>
  <artifactId>camunda-bpm-spring-boot-starter-external-task-client</artifactId>
</dependency>
<dependency>
    <groupId>org.camunda.community.rest</groupId>
    <artifactId>camunda-platform-7-rest-client-spring-boot-openapi</artifactId>
    <version>7.17.2</version>
</dependency>

My configuration file is very simple.

camunda.bpm.admin-user.id=admin
camunda.bpm.job-execution.enabled=true
camunda.bpm.filter.create=All tasks
camunda.bpm.admin-user.password=admin

Hi @yulinyang,

you put the process engine and the external task worker into the same application?

@Ingo_Richtsmeier

No, I’m sorry I didn’t provide you with a clear description.
My server and client are two microservices

Hello,

In our case, we have the following configuration:

camunda.bpm.client.base-url=${CAMUNDA_BASE_URL}
camunda.bpm.client.worker-id=our-worker-id
camunda.bpm.client.basic-auth.username=${CAMUNDA_USERNAME}
camunda.bpm.client.basic-auth.password=${CAMUNDA_PASSWORD}
camunda.bpm.client.async-response-timeout=1000

I also noticed that no matter what we put on the worker-id property, it always uses the default value.

We are using the dependency on our spring boot backend application (we provide a REST API and we have the handlers in place to process the Camunda External Tasks):

...
    <camunda-platform.version>7.18.0</camunda-platform.version>
...
<dependency>
    <groupId>org.camunda.bpm.springboot</groupId>
    <artifactId>camunda-bpm-spring-boot-starter-external-task-client</artifactId>
    <version>${camunda-platform.version}</version>
</dependency>

Then our handlers class is basically this:

@Configuration
@AllArgsConstructor
public class AppExternalTaskHandlers {

    @Bean
    @ExternalTaskSubscription(topicName = ExternalTaskApprove.TOPIC)
    public ExternalTaskHandler approveHandler() {
        // ...
    }
   
    // ...
}