There is a first step to fix that issue but it was not sufficient.
The LiveMeasures updates in a single transaction must be ordered in order to prevent this deadlock.
PersistLiveMeasuresStep$MeasureVisitor#visitAny is doing that only for multiple subsets, so the main issue should be in that loop. A quick solution would be to first store the whole list of liveMeasures, then order that list and execute the insertOrUpdate after visiting all component.
Other investigated tracks :
- Escalation mechanism that make the RDBMS lock the table but this does not occur because :
- the logs is clearly stating "Share Lock"
- Postgresql does not seems to use this mechanism
- Multiple live measures with same component uuid and same metric id, but I don't think this will trigger a deadlock (because it's an unique key)