Multiple Machines High FetchAndLock Traffic


I have been getting bombed with the following error -

06-Jul-2020 00:41:38.034 WARNING [http-nio-8089-exec-453] At the moment the server has to handle too many requests at the same time. Please try again later.
	at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(
	at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(
	at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(
	at javax.servlet.http.HttpServlet.service(
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(
	at org.apache.catalina.core.StandardWrapperValve.invoke(
	at org.apache.catalina.core.StandardContextValve.invoke(
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
	at org.apache.catalina.core.StandardHostValve.invoke(
	at org.apache.catalina.valves.ErrorReportValve.invoke(
	at org.apache.catalina.core.StandardEngineValve.invoke(
	at org.apache.catalina.connector.CoyoteAdapter.service(
	at org.apache.coyote.http11.Http11Processor.service(
	at org.apache.coyote.AbstractProcessorLight.process(
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$ Source)
	at org.apache.tomcat.util.threads.TaskThread$
	at Source)

I was wondering if it might be related to the fact that I am using the FetchAndLock rest API against my own c# services implementations with the asyncResponseTimeout parameter.
I wanted to ask a few things,

  1. Is there a limit to the amount of requests that Camunda can hold with this mechanism?
  2. Can I increase this limit?
  3. Can this limit be the reason for the error?
  4. If not then what might be the cause for such an error?

A bit more Context:

We are attempting to expand and scale out our servers,
We got C# services which are using the FetchAndLock Camunda API to get external tasks from different BPMNs.
So for example if we had 1 machine/server with 3 services which constantly sending FetchAndLock requests to our tomcat/camunda machine.
Now we are trying to scale out so that instead of 1 machine with 3 services we will have 3 machines with 3 services each. So now we got a total of 9 services which are constantly sending FetchAndLock requests to the camunda engine (with some pausing with the asyncResponseTimeout property)

Thank you in advance!

Hi Ivgi,

I am checking the engine code in Camunda 7.13.

Looking at your stack trace and the java code, I found that each deferred request gets added to a blocking queue. The limit for this queue is up to 200 (class

protected BlockingQueue<FetchAndLockRequest> queue = new ArrayBlockingQueue<>(200);

Requests are added when they are deferred if the asyncResponseTimeout is not null and there are not tasks to be returned (class :

 if (result.wasSuccessful()) {
  List<LockedExternalTaskDto> lockedTasks = result.getTasks();
  if (!lockedTasks.isEmpty() || dto.getAsyncResponseTimeout() == null) { // response immediately if tasks available

    LOG.log(Level.FINEST, "Resuming request with {0}", lockedTasks);
  } else {

    LOG.log(Level.FINEST, "Deferred request");

If the queue is full, then you get this exception that you saw (class

protected void addRequest(FetchAndLockRequest request) {
    if (!this.queue.offer(request)) {
        AsyncResponse asyncResponse = request.getAsyncResponse();


It seems that your requests are filling up that queue, making the server unable to serve your workers anymore. The queue should get emptied out in the next run of the acquire() method, which cleans the queue, copies the content to another list, and iterates over it to respond to each caller. I would also investigate how your Camunda database is handling that load. Maybe you can activate some logging that could help you understand further what is going on (, such as:


I couldn’t find a way to overwrite this property. The best is to check if you can find something going on with your Camunda instance, or to scale your Camunda nodes horizontally so they can serve more workers.