We're updating the issue view to help you get more done. 

ConcurrentModificationException when adding a BeforeTransactionCompletionProcess from with a PostInsertEventListener for an @Audited entity

Description

Simple gradle project that demonstrates this issue

https://github.com/cameronbraid/hibernate-envers-cme

Clone it, run ./gradlew and see the exception

1 2 3 4 5 6 7 8 9 Exception in thread "main" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:819) at java.util.ArrayList$Itr.next(ArrayList.java:791) at org.hibernate.engine.spi.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:660) at org.hibernate.engine.spi.ActionQueue.beforeTransactionCompletion(ActionQueue.java:307) at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:611) at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:105) at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175) at demo.Main.main(Main.java:74)

The issue arises with an @Audited entity when you add a BeforeTransactionCompletionProcess from within an PostInsertEventListener

main code is in https://github.com/cameronbraid/hibernate-envers-cme/blob/master/src/main/java/demo/Main.java

Environment

None

Status

Assignee

Lukasz Antoniak

Reporter

Cameron Braid

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

4.1.5.SP1

Priority

Major