gortiz opened a new pull request, #17804:
URL: https://github.com/apache/pinot/pull/17804

   We have detected that sometimes queries fail with:
   
   ```
   java.lang.RuntimeException: Got error block: {QUERY_VALIDATION=Cannot invoke 
"java.util.regex.Pattern.matcher(java.lang.CharSequence)" because the return 
value of "org.apache.pinot.common.utils.regex.JavaUtilPattern.getPattern()" is 
null}
   ```
   
   As shown in the code, getPattern should always be not null, as there are 
only 2 constructors and both set the attribute to a not null value. But as 
explained in https://shipilev.net/blog/2014/safe-public-construction/, when one 
thread instantiates an object and another reads its values, the second may 
receive the instance before it is completely instanciated.
   
   This can be solved, as indicated on that blog post, by making the attribute 
final. Specifically:
   
   >  Java Memory Model guarantees this if all the fields in object are final 
and there is no leakage of the under-initialized object from constructor.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to