Hi there,
I just wanted to report an issue I spotted when going through the code of the Camunda Engine. In ExpressionManager
, there is piece of code:
protected ELResolver getCachedElResolver() {
if (elResolver == null) {
synchronized(this) {
if (elResolver == null) {
elResolver = createElResolver();
}
}
}
return elResolver;
}
Problems is:
- In short:
elResolver
is not volatile. - More details: What could happen is that
elResolver
can be not fully initialized when read by other threads. Of course, such issue is difficult to detect, especially because most of servers run with x86 CPUs that have a TSO memory model so it cannot happen but can occur with other architectures (e.g PowerPC).
Solution: make it volatile.
More information about this kind of issue https://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
Paul