Skip to content

Unsafe double-checked locking in SpelExpression#compileExpression #24265

@PascalSchumacher

Description

@PascalSchumacher

The double-checked locking SpelExpression#compileExpression does not seem to be thread safe, because compiledAst is not volatile, see:

https://github.com/spring-projects/spring-framework/blob/master/spring-expression/src/main/java/org/springframework/expression/spel/standard/SpelExpression.java#L506

Or am I missing something?

Edit:
Also SpelExpression#compileExpression uses this.expression (a String) as a lock object. Shouldn't this be avoided, as Strings objects are shared throughout the program?

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions