Exception while completing the external task: The corresponding process instance could not be resumed

I have the following setup:

  1. Camunda 7.10 on apache server
  2. Process definition with about 20 external tasks
  3. ~ 20 external workers on a separate machine. External worker is built using guide from official site. Long polling timeout - 10000, lock duration - 10000.

Running process usually results in 2 errors on external worker side.
Error when trying to complete task using API
externalTaskService.complete(externalTask, vars);

[TopicSubscriptionManager] ERROR com.netcracker.solutions.om.extworker.ExternalWorkerStub - #5: complete FAILED
org.camunda.bpm.client.exception.NotResumedException: TASK/CLIENT-01009 Exception while completing the external task: The corresponding process instance could not be resumed
at org.camunda.bpm.client.impl.ExternalTaskClientLogger.externalTaskServiceException(ExternalTaskClientLogger.java:117)
at org.camunda.bpm.client.task.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:60)
at org.camunda.bpm.client.task.impl.ExternalTaskServiceImpl.complete(ExternalTaskServiceImpl.java:52)
at com.netcracker.solutions.om.extworker.ExternalWorkerStub$StubClient.lambda$run$0(ExternalWorkerStub.java:69)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.handleExternalTask(TopicSubscriptionManager.java:143)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.lambda$acquire$0(TopicSubscriptionManager.java:102)
at java.util.Arrays$ArrayList.forEach(Arrays.java:3880)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:97)
at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:81)
at java.lang.Thread.run(Thread.java:748)

This task is fetched second time by another worker again and completed normally.
Also I’ve added try-catch clause, and in case of error try to complete task once again in the same transaction - this works.

It would be preferrable to avoid such exceptions and understand why do they occur, due to some misconfiguration, bug or smth else.
Could you please advise?

Thanks

1 Like

Hi @Andrey1

have you tried to set the max number of tasks a client can work on to 1?

ExternalTaskClient client = ExternalTaskClient.create().baseUrl(…)
.asyncResponseTimeout(…).maxTasks(1).build();

I also had some problems with using multiple ExternalTask clients. This configuration fixed it for me.

Hope that helps.

Regards
Michael

Hi @MichiDahm.
you know…maxTasks(1) works for me too :).
I thought that 1 is default value, but it turned out that client by default fetches 10 tasks.

Thanks very much for help.

Hi @Andrey1,

nice to hear that it works :grinning:

I also found out, that the default value is 10 but the best-practice is to use it with a maximum of 1.

BTW this is my forum-post where the answer was provided: Multiple External Task Client instances

Regards
Michael

Probably I was too optimistic. Error is still raised but not so often. Timeout is enough to complete the task.
The peculiarity of the process that it have several parallel branches with external tasks. Maybe there’s concurrency on completing tasks in 1 process instance. All tasks are marked as “async before”.

Hi guys,

the error is most likely caused by some problem further down in your model. You are using the client thread of your external worker from the complete onwards, so if you get an exception in your process, it will roll back the transaction and your worker will be faced with that exception. That results in the error message you see.

One solution would be to mark the external task as async after, so you can see the actual incident in cockpit.

Cheers,
Ben