Camunda Client break while locking the task with External topic

Hi, all I’m using C# Camunda Client Nuget Package by Berndruecker. Sometimes I see that an exception occurs while executing the external task. Following is the exception detail.

We have deployed the service and that service communicates with Camunda Engine using the Camunda Client Library. Is there any issue with the networking which causing this issue? sharing the exception detail below. Would appreciate any thoughts.

System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at CamundaClient.Service.ExternalTaskService.FetchAndLockTasks(FetchAndLockRequest fetchAndLockRequest)
   at CamundaClient.Service.ExternalTaskService.FetchAndLockTasks(String workerId, Int32 maxTasks, IEnumerable`1 topicNames, Int64 lockDurationInMilliseconds, IEnumerable`1 variablesToFetch)
   at CamundaClient.Service.ExternalTaskService.FetchAndLockTasks(String workerId, Int32 maxTasks, String topicName, Int64 lockDurationInMilliseconds, IEnumerable`1 variablesToFetch)
   at CamundaClient.Worker.ExternalTaskWorker.DoPolling()
   at CamundaClient.Worker.ExternalTaskWorker.<StartWork>b__11_0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()

Hi @hello.aliasad,

Can you provide some additional information on this issue?

  • Does the external task you are attempting to lock still exist?
  • Is it successfully locked on the engine side?
  • Is there any new data in the ACT_HI_EXT_TASK_LOG table?

Best,
Nikola

1 Like

Thanks @nikola.koevski for replying. I think the lock was successful. But after a while, the pod crashes. Is it because the pod is failing to keep the background thread alive? I’m not sure if it’s an issue in the library or at our environment. Running out of options. Any help would be highly appreciated.

Sharing the complete log for better understanding.

e[40me[1me[33mwarne[39me[22me[49m: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to bind to http://localhost:5000 on the IPv6 loopback interface: 'Cannot assign requested address'.
e[40me[1me[33mwarne[39me[22me[49m: Microsoft.AspNetCore.Server.Kestrel[0]
      Unable to bind to https://localhost:5001 on the IPv6 loopback interface: 'Cannot assign requested address'.
e[40me[32minfoe[39me[22me[49m: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
e[40me[32minfoe[39me[22me[49m: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
e[40me[32minfoe[39me[22me[49m: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
e[40me[32minfoe[39me[22me[49m: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
e[40me[32minfoe[39me[22me[49m: Microsoft.Hosting.Lifetime[0]
      Content root path: /app
e[40me[32minfoe[39me[22me[49m: UNISTAD.SOP.Service.CamundaService[0]
      Try 1: Connecting with CamundaEngine endpoint https://obuoc-stg.hostcountry.qa/workflowcamunda/engine-rest/engine/default/
Register Task Worker for Topic 'ZucchettiEmergency'
Register Task Worker for Topic 'ZucchettiEmergencyOff'
Register Task Worker for Topic 'emailService'
Register Task Worker for Topic 'TeamsMeeting'
Register Task Worker for Topic 'HoneywellACSEmergency'
Register Task Worker for Topic 'HoneywellACSResumenormality'
Register Task Worker for Topic 'CiscoVDTrigger'
e[40me[32minfoe[39me[22me[49m: UNISTAD.SOP.Service.CamundaService[0]
      SOP service linked with Camunda Engine successfully!
One or more errors occurred. (A task was canceled.)
Unhandled exception. System.AggregateException: One or more errors occurred. (A task was canceled.)
 ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at CamundaClient.Service.ExternalTaskService.FetchAndLockTasks(FetchAndLockRequest fetchAndLockRequest) in /home/vsts/work/1/s/CamundaClient/Service/ExternalTaskService.cs:line 75
   at CamundaClient.Worker.ExternalTaskWorker.DoPolling() in /home/vsts/work/1/s/CamundaClient/Worker/ExternalTaskWorker.cs:line 51
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool)
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
   at System.Threading.TimerQueue.FireNextTimers()

Hey @hello.aliasad

not familiar with the External Task worker code, but I had a small look and it seems that Exceptions from the HttpClient are not handled and re-thrown.

I could imagine that there happens a cancellation inside the HttpClient or an timeout which causes this, here is the related code camunda-csharp-client/ExternalTaskService.cs at master · berndruecker/camunda-csharp-client · GitHub

Greets
Chris

3 Likes

Thank you very much. :slight_smile: