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

Avoid NPE if snapshotMgr failed during init #2879

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

AndreyBozhko
Copy link
Contributor

https://issues.apache.org/jira/browse/SOLR-XXXXX

Description

Avoid NPE when SolrCore is closing.

If the snapshotMgr failed to initialize (e.g., because it didn't have write permission to create the snapshot metadata folder), SolrCore begins its close routine and may encounter a NPE because snapshotMgr is null.

11:07:29.001 [coreLoadExecutor-12-thread-1] ERROR org.apache.solr.core.SolrCore - Error while closing
java.lang.NullPointerException: null
	at org.apache.solr.core.SolrCore.doClose(SolrCore.java:1879) ~[solr-core-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at org.apache.solr.core.SolrCore.close(SolrCore.java:1755) ~[solr-core-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1223) ~[solr-core-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at org.apache.solr.core.SolrCore.<init>(SolrCore.java:1056) ~[solr-core-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at org.apache.solr.core.CoreContainer.createFromDescriptor(CoreContainer.java:1705) ~[solr-core-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at org.apache.solr.core.CoreContainer.lambda$loadInternal$12(CoreContainer.java:1043) ~[solr-core-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at com.codahale.metrics.InstrumentedExecutorService$InstrumentedCallable.call(InstrumentedExecutorService.java:234) ~[metrics-core-4.2.20.jar:4.2.20]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:294) ~[solr-solrj-9.4.0.jar:9.4.0 71e101bb37497f730078d9afe1991b60d10bfe96 - stillalex - 2023-10-10 19:10:39]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:829) [?:?]

Solution

Please provide a short description of the approach taken to implement your solution.

Tests

Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.

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 have given Solr maintainers access to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
  • 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 Nov 20, 2024

Thanks. Ideally add a JIRA & CHANGES.txt entry but I'm personally fine with simply merging this trivial change as-is. So if nobody says anything or you don't bother, that's what I'll do by end of week.

@AndreyBozhko
Copy link
Contributor Author

Thanks - it also seemed to me that the change is too minor to warrant a JIRA.

@dsmiley dsmiley merged commit 8de5721 into apache:main Nov 21, 2024
2 of 3 checks passed
dsmiley pushed a commit that referenced this pull request Nov 21, 2024
@AndreyBozhko AndreyBozhko deleted the snapshotmgr-npe branch November 21, 2024 22:09
@dsmiley
Copy link
Contributor

dsmiley commented Nov 21, 2024

I pushed to 9x too: 119b986
Thanks.

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