Camunda 7 Transaction Rollback Issue Explained – Causes, Symptoms & Fixes

 In Camunda 7, transactions are managed automatically by the process engine.

However, one of the most confusing production issues is:

Process execution rolls back unexpectedly, tasks are not completed, variables are lost, and no clear error is visible in Cockpit.

This blog explains what transaction rollback means in Camunda, why it happens, how to identify the root cause, and best practices to avoid it.


1️⃣ What Is a Transaction Rollback in Camunda 7?

Camunda executes BPMN steps inside database transactions.
If any exception occurs, the entire transaction is rolled back, meaning:

  • Task completion is undone

  • Variables are not saved

  • Process execution returns to the previous state

  • Jobs may retry or create incidents

➡️ This is expected behavior but often misunderstood.


2️⃣ Common Symptoms of Transaction Rollback

You may observe:

  • Task completes but reappears

  • Process does not move to the next step

  • Variables disappear after submission

  • Job retries keep decreasing

  • Incident created without clear reason

  • No data committed to the database


3️⃣ Most Common Root Causes

🔴 1. Exception in Java Delegate / Listener

Any unchecked exception triggers rollback.

throw new RuntimeException("Failure");

📌 Result: Entire transaction is rolled back.

Fix:

  • Catch and handle business exceptions properly

  • Use BpmnError for business errors

throw new BpmnError("BUSINESS_ERROR");

🔴 2. Database Constraint Violations

Examples:

  • NOT NULL violation

  • Unique constraint failure

  • Foreign key violation

These often do not appear clearly in Cockpit.

Fix:

  • Check application + DB logs

  • Validate data before persistence


🔴 3. External System Failure Inside Transaction

Calling REST APIs, message queues, or file systems inside a transaction is dangerous.

If the external call fails:

  • Camunda rolls back everything

  • External system may already be updated (inconsistency)

Fix:

  • Use asyncBefore / asyncAfter

  • Externalize heavy logic

  • Use message queues or external workers


🔴 4. Async Boundaries Misunderstood

Without async boundaries, everything runs in one transaction.

❌ Problem:

Service Task → DB Update → REST Call → Next Task

If REST fails → DB update rolls back.

Fix:
Use async continuation:

asyncBefore = true

This creates transaction boundaries.


🔴 5. Job Executor Retry & Rollback Loop

When a job fails:

  • Transaction rolls back

  • Retry count decreases

  • After retries = 0 → incident created

If root cause is not fixed, rollback happens repeatedly.


🔴 6. Transaction Timeout

Long-running logic may exceed transaction timeout.

Symptoms:

  • No explicit error in Cockpit

  • Silent rollback

Fix:

  • Reduce transaction duration

  • Increase timeout

  • Split logic using async steps


🔴 7. Spring Transaction Misconfiguration

In Spring Boot projects:

  • Nested transactions

  • Wrong propagation (REQUIRED, REQUIRES_NEW)

can cause unexpected rollbacks.

Fix:

  • Review @Transactional usage

  • Avoid mixing Camunda and custom transactions incorrectly


4️⃣ How to Identify the Real Cause

✔ Step-by-step Debugging

✔ Enable DEBUG logs:

org.camunda.bpm.engine org.springframework.transaction

✔ Check timestamps in logs
✔ Inspect retries and incidents in Cockpit
✔ Verify DB logs (deadlocks, timeouts)
✔ Review custom code for unchecked exceptions


5️⃣ SQL Queries for Investigation

SELECT * FROM ACT_RU_JOB WHERE RETRIES_ < 3;
SELECT * FROM ACT_RU_INCIDENT;

These help identify rollback-triggering jobs.


6️⃣ Best Practices to Avoid Rollbacks

✅ Keep transactions short
✅ Use BpmnError for business logic
✅ Add asyncBefore for external calls
✅ Avoid heavy logic inside delegates
✅ Monitor retries and incidents
✅ Log full stack traces


7️⃣ When to Ask for Expert Help

If:

  • Rollbacks happen only in production

  • No visible error appears

  • System behaves inconsistently under load

Then deep production debugging is required.


💼 Professional Support Available

If you are facing transaction rollback issues, silent failures, or unstable process execution in Camunda 7, I provide paid consulting, production debugging, project support, and focused trainings.

📧 Contactishikhanirankari@gmail.com | info@realtechnologiesindia.com

🌐 WebsiteIT Trainings | Digital metal podium 


Comments

Popular posts from this blog

jBPM Installation Guide: Step by Step Setup

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained