flowable/flowable-engine · error · FlowableException

error occurred while waiting for activity=${activity} for pr

Error message

error occurred while waiting for activity=${activity} for processInstanceId=${processInstanceId}

What it means

FlowableProducer.signal polls (with Thread.sleep) for the target wait-state execution to appear while the process is asynchronously moved to the expected activity. Flowable wraps an InterruptedException raised during that sleep into this FlowableException, so the wait for the activity was interrupted.

Source

Thrown at modules/flowable-camel/src/main/java/org/flowable/camel/FlowableProducer.java:124

    }

    protected boolean shouldStartProcess() {
        return activity == null;
    }

    protected void signal(Exchange exchange) {
        String processInstanceId = findProcessInstanceId(exchange);
        String executionId = exchange.getProperty(EXECUTION_ID_PROPERTY, String.class);

        boolean firstTime = true;
        long initialTime = System.currentTimeMillis();

        Execution execution = null;
        while (firstTime || (timeout > 0 && (System.currentTimeMillis() - initialTime < timeout))) {
            try {
                Thread.sleep(timeResolution);
            } catch (InterruptedException e) {
                throw new FlowableException("error occurred while waiting for activity=" + activity + " for processInstanceId=" + processInstanceId, e);
            }
            firstTime = false;

            if (executionId != null) {
                execution = runtimeService.createExecutionQuery()
                        .executionId(executionId)
                        .activityId(activity)
                        .singleResult();

            } else {
                execution = runtimeService.createExecutionQuery()
                        .processDefinitionKey(processKey)
                        .processInstanceId(processInstanceId)
                        .activityId(activity)
                        .singleResult();
            }

            if (execution != null) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Investigate why the thread was interrupted (shutdown, cancellation) and ensure processes are not signalled during shutdown.
  2. Restore the interrupt status in your own calling code if you swallow the interruption, and handle graceful shutdown of in-flight exchanges.
  3. Avoid interrupting worker threads executing Camel routes; rely on Camel's graceful shutdown with sufficient timeout.
  4. Increase gracefulShutdownTimeout on the CamelContext so in-flight waits complete.

Example fix

// before
thread.interrupt(); // during in-flight flowable producer call
// after
camelContext.shutdown(); // graceful shutdown, allows in-flight waits to finish
Defensive patterns

Strategy: try-catch

Try / catch

try {
    producer.process(exchange);
} catch (FlowableException e) {
    if (e.getCause() instanceof InterruptedException) {
        Thread.currentThread().interrupt(); // restore interrupt status
        throw new IllegalStateException("Flowable activity wait interrupted by shutdown", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: The thread waiting on executionId/activity polling is interrupted (Thread.interrupt) during Thread.sleep(timeResolution) inside signal, typically when the surrounding Camel route or container is shutting down or the caller cancels the task.

Common situations: Application shutdown/redeploy while a synchronous flowable: producer call is in-flight; timeout/monitoring infrastructure interrupting long-running worker threads; future/task cancellation upstream.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/fd2cf96b5df27103. Report an issue: GitHub.