Skip to content

Conversation

@chrfwow
Copy link

@chrfwow chrfwow commented Dec 10, 2025

This PR fixes a race condition that can be triggered when adding new operators, and slightly improves the cache lookup

Comment on lines -83 to 85
if (evaluator == null) {
evaluator = new JsonLogicEvaluator(expressions);
JsonLogicEvaluator localEvaluator = this.evaluator.get();
if (localEvaluator == null) {
this.evaluator.compareAndSet(null, new JsonLogicEvaluator(expressions));
localEvaluator = this.evaluator.get();
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could have led to a lost write when an operation is added while one thread is in this if-statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants