Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-15960: Use ConcurrentHashMap for EnvUtils.camelCaseToDotsMap #2204

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

pjmcarthur
Copy link
Contributor

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:

  • I have reviewed the guidelines for How to Contribute and my code conforms to the standards described there to the best of my ability.
  • I have created a Jira issue and added the issue ID to my pull request title. (I attached this to the existing Jira)
  • I have given Solr maintainers access to contribute to my PR branch. (optional but recommended)
  • I have developed this patch against the main branch.
  • I have run ./gradlew check.
  • I have added tests for my changes.
  • I have added documentation for the Reference Guide

@dsmiley
Copy link
Contributor

dsmiley commented Jan 17, 2024

I think camelCaseToDotSeparated should be implemented using computeIfAbsent

@dsmiley dsmiley self-requested a review January 18, 2024 02:39
@dsmiley dsmiley merged commit d7e53fe into apache:main Jan 18, 2024
3 of 4 checks passed
dsmiley added a commit that referenced this pull request Jan 18, 2024
* Use ConcurrentHashMap and use computeIfAbsent

Co-authored-by: Paul McArthur <[email protected]>
Co-authored-by: David Smiley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants