Using an event listener (eg. PreDeleteEventListener) that calls flush itself, leads to infinite loop where flush re-triggers the same event.
Use case: batch processing inside event listener, where entity manager’s flush and clear is called after each batch was processed.
Triggering flushes from a flush is not supported. In fact you need to be careful about even loading things into the Session during flush - it is also not technically supported
Shouldn’t this be handled better instead of an infinite loop?
Such as a mechanism that detects a flush is occurring and throw an error instead.
To be honest, I have never seen this result in an infinite loop. And you did not attach a reproducer, so…
Usually the outcome is a CCME