Skip to content

Commit

Permalink
Add trace logging when SSLService is set (#42272)
Browse files Browse the repository at this point in the history
Something is causing this to be set twice in LicenseTribeTests.
These tribe tests do weird things to work around the SetOnce that
XPackPlugin uses for the SslService, but that seems to be failing
randomly.

This additional logging will help work out which plugin instance is
setting the SSLService when it should not be.

Relates: #42004
Backport of: #42210
  • Loading branch information
tvernum authored May 21, 2019
1 parent 63364a3 commit b30bbf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*/
package org.elasticsearch.xpack.core;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.SpecialPermission;
import org.elasticsearch.Version;
Expand Down Expand Up @@ -155,7 +155,12 @@ protected Clock getClock() {
protected SSLService getSslService() { return getSharedSslService(); }
protected LicenseService getLicenseService() { return getSharedLicenseService(); }
protected XPackLicenseState getLicenseState() { return getSharedLicenseState(); }
protected void setSslService(SSLService sslService) { XPackPlugin.sslService.set(sslService); }

protected void setSslService(SSLService sslService) {
logger.trace("Setting SSLService to [{}] for plugin [{}]", sslService, this);
XPackPlugin.sslService.set(sslService);
}

protected void setLicenseService(LicenseService licenseService) { XPackPlugin.licenseService.set(licenseService); }
protected void setLicenseState(XPackLicenseState licenseState) { XPackPlugin.licenseState.set(licenseState); }
public static SSLService getSharedSslService() { return sslService.get(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest;
import org.elasticsearch.protocol.xpack.license.GetLicenseRequest;
import org.elasticsearch.test.junit.annotations.TestLogging;

import static org.elasticsearch.license.TestUtils.generateSignedLicense;

@TestLogging("org.elasticsearch.xpack.core.XPackPlugin:TRACE,org.elasticsearch.xpack.CompositeTestingXPackPlugin:TRACE")
public class LicenseTribeTests extends TribeTransportTestCase {

@Override
Expand Down

0 comments on commit b30bbf4

Please sign in to comment.