Elasticsearch suddenly stops working with error java.security.cert.CertificateExpiredException in Bitbucket Server
Platform Notice: Server and Data Center Only. This article only applies to Atlassian products on the server and data center platforms.
Code search suddenly stops working in Bitbucket Datacenter with a remote ElasticSearch instance.
Bitbucket Datacenter: Any version with a remote ElasticSearch instance.
You would see an error like below in the atlassian-bitbucket.log, right after the start-up of the instance when Bitbucket is trying connect to ElasticSearch for the first time:
2022-03-28 22:55:58,610 ERROR [Caesium-1-4] c.a.b.i.s.i.IndexingSynchronizationService An error was encountered while checking or creating the mapping in Elasticsearch com.atlassian.bitbucket.internal.search.indexing.exceptions.IndexException: Unable to check whether a valid mapping exists in Elasticsearch ... Caused by: java.util.concurrent.ExecutionException: javax.net.ssl.SSLHandshakeException: PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed ... Caused by: java.security.cert.CertificateExpiredException: NotAfter: Thu Mar 24 06:00:00 GMT-06:00 2022
The error CertificateExpiredException indicates that the certificate that's applied on the ElasticSeach instance was expired on the date mentioned in the log entry. In the example above, it got expired on March 24 2022.
You will need to update the certificate in the cert store of the remote Elastic search instance to one that hasn't expired.
If you still have any issues with search after that, please get in touch with Atlassian Support.