SOLR-15960: Use ConcurrentHashMap for EnvUtils.camelCaseToDotsMap #2204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/SOLR-15960
Description
The test run in #2126 (and #2202, I think) has failed for some Collection creation tests. The stack trace is
Caused by: java.lang.NullPointerException: key can't be null at java.base/java.lang.System.checkKey(System.java:956) at java.base/java.lang.System.getProperty(System.java:826) at org.apache.solr.common.util.EnvUtils.getPropWithCamelCaseFallback(EnvUtils.java:169) at org.apache.solr.common.util.EnvUtils.getProp(EnvUtils.java:153) at org.apache.solr.common.util.PropertiesUtil.substitute(PropertiesUtil.java:68)
It seems that
getPropWithCamelCaseFallback
has returned a null value for a key name. I suspect this may be caused by a concurrency issue causing an inconsistent view of the map state between threads, as the tests that failed use multiple nodes.Solution
Changed camelCaseToDotsMap to be a ConcurrentHashMap to eliminate possible race conditions.
Tests
I have not been able to reproduce this reliably in a test.
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.