{"record":{"id":"fd2cf96b5df27103","repo":"flowable/flowable-engine","slug":"error-occurred-while-waiting-for-activity-activi","errorCode":null,"errorMessage":"error occurred while waiting for activity=${activity} for processInstanceId=${processInstanceId}","messagePattern":"error occurred while waiting for activity=(.+?) for processInstanceId=(.+?)","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-camel/src/main/java/org/flowable/camel/FlowableProducer.java","lineNumber":124,"sourceCode":"    }\n\n    protected boolean shouldStartProcess() {\n        return activity == null;\n    }\n\n    protected void signal(Exchange exchange) {\n        String processInstanceId = findProcessInstanceId(exchange);\n        String executionId = exchange.getProperty(EXECUTION_ID_PROPERTY, String.class);\n\n        boolean firstTime = true;\n        long initialTime = System.currentTimeMillis();\n\n        Execution execution = null;\n        while (firstTime || (timeout > 0 && (System.currentTimeMillis() - initialTime < timeout))) {\n            try {\n                Thread.sleep(timeResolution);\n            } catch (InterruptedException e) {\n                throw new FlowableException(\"error occurred while waiting for activity=\" + activity + \" for processInstanceId=\" + processInstanceId, e);\n            }\n            firstTime = false;\n\n            if (executionId != null) {\n                execution = runtimeService.createExecutionQuery()\n                        .executionId(executionId)\n                        .activityId(activity)\n                        .singleResult();\n\n            } else {\n                execution = runtimeService.createExecutionQuery()\n                        .processDefinitionKey(processKey)\n                        .processInstanceId(processInstanceId)\n                        .activityId(activity)\n                        .singleResult();\n            }\n\n            if (execution != null) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-camel/src/main/java/org/flowable/camel/FlowableProducer.java#L106-L142","documentation":"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.","triggerScenarios":"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.","commonSituations":"Application shutdown/redeploy while a synchronous flowable: producer call is in-flight; timeout/monitoring infrastructure interrupting long-running worker threads; future/task cancellation upstream.","solutions":["Investigate why the thread was interrupted (shutdown, cancellation) and ensure processes are not signalled during shutdown.","Restore the interrupt status in your own calling code if you swallow the interruption, and handle graceful shutdown of in-flight exchanges.","Avoid interrupting worker threads executing Camel routes; rely on Camel's graceful shutdown with sufficient timeout.","Increase gracefulShutdownTimeout on the CamelContext so in-flight waits complete."],"exampleFix":"// before\nthread.interrupt(); // during in-flight flowable producer call\n// after\ncamelContext.shutdown(); // graceful shutdown, allows in-flight waits to finish","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    producer.process(exchange);\n} catch (FlowableException e) {\n    if (e.getCause() instanceof InterruptedException) {\n        Thread.currentThread().interrupt(); // restore interrupt status\n        throw new IllegalStateException(\"Flowable activity wait interrupted by shutdown\", e);\n    }\n    throw e;\n}","preventionTips":["Avoid interrupting threads running Camel routes; use graceful shutdown with adequate timeouts.","Do not fire flowable producer calls during application shutdown phases.","Handle task cancellation by completing in-flight exchanges first."],"tags":["camel","flowable","interrupted","wait-state"],"backgroundTag":"request-timeout","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}