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

ClientToServerDisruptor NPE when using a Dynamic Config #68

Open
aurbroszniowski opened this issue May 26, 2020 · 2 comments
Open

ClientToServerDisruptor NPE when using a Dynamic Config #68

aurbroszniowski opened this issue May 26, 2020 · 2 comments
Assignees
Labels
bug Something isn't working important

Comments

@aurbroszniowski
Copy link
Member

When using a Dynamic config, the Tsa.licenseAll() method (which updates the Tsa ports with proxied ports in case of a using a disruption controller) is never called.
Therefore the Tsa is not updated with proxied ports, and the disruption controller instance gives a NPE
See this failing test:

  public void testReconnectFailureHandling() throws Exception {
    ConfigurationContext configContext = customConfigurationContext()
        .tsa(tsa -> tsa
            .topology(
                new Topology(
                    distribution(version(VERSION), PackageType.KIT, LicenseType.TERRACOTTA),
                    true,
                    dynamicCluster(
                        stripe(
                            server("Server1", "localhost")
                                .tsaPort(9517)
                                .tsaGroupPort(9537)
                                .configRepo("terracotta1/repository")
                                .logs("logs1")
                                .metaData("terracotta1/metadata")
                                .failoverPriority("availability")
                        )
                    )
                )
            ).license(new License(getLicenseURL()))
        );

    try (ClusterFactory factory = new ClusterFactory("testReconnectFailureHandling", configContext)) {
      Tsa tsa = factory.tsa();
      tsa.startAll();
      tsa.attachAll();
      tsa.activateAll();

      final ClientToServerDisruptor disruptor = tsa.disruptionController().newClientToServerDisruptor();
      final URI terracottaServerURI = disruptor.uri();

    }
  }

@saurabhagas
Copy link

Moving it to @mobasherul as he's worked on the disruption part.

@mobasherul
Copy link
Contributor

I used to call tsa.updateToProxiedPorts explicitly in test and use those ports to change public host ports to test client to server disruption in Dynamic cluster. Something like -
Tsa tsa = factory.tsa().startAll().activateAll();
Map<ServerSymbolicName, Integer> proxyTsaPorts = tsa.updateToProxiedPorts();
TerracottaServer terracottaServer = tsa.getActive();
int proxyPort = proxyTsaPorts.get(terracottaServer.getServerSymbolicName());
ConfigToolExecutionResult result = tsa.configTool(terracottaServer).executeCommand("set", "-s", "localhost:" + terracottaServer.getTsaPort(),
"-c", "stripe.1.node.1.node-public-hostname=localhost", "-c", "stripe.1.node.1.node-public-port=" + proxyPort);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working important
Projects
None yet
Development

No branches or pull requests

3 participants