Problem with testing compensation when timers are present in transaction

Description

There is a problem with unit testing compensation (specifically with transactions and JobExecutor), when timers are present in transaction. Attached project with unit tests shows the problem.

Simple steps to reproduce BPMN:
1. Make simple diagram with service task and compensation in transaction
2. Add one timer before service task, and one after service task
3. In the end, transaction should be canceled (end event with cancellation)

Unit test:
1. Set process time in the future (to execute first timer)
2. Fire waitForJobExecutorToProcessAllJobs for 10 seconds
3. Nice PERSISTENCE EXCEPTION flashes in logs, or TimeLimitWasExceeded (race condition?).

Sometimes it works (race condition again?). When it does, to reproduce error, simply add to transaction another service task, and another timer. Everything is in attached project.

JobExecutor is enabled.

Environment

None

Status

Assignee

Joram Barrez

Reporter

Michał Wesoły

Labels

None

Components

Affects versions

Priority

Medium
Configure