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

APP-2970: Fixed infinite call loop in SymConfig #187

Merged
merged 1 commit into from
Aug 31, 2020
Merged

APP-2970: Fixed infinite call loop in SymConfig #187

merged 1 commit into from
Aug 31, 2020

Conversation

symphony-elias
Copy link
Contributor

No description provided.

@symphony-elias symphony-elias requested review from thibauult, symphony-hong and a team August 27, 2020 11:17
Copy link
Contributor

@symphony-youri symphony-youri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to add a test reproducing the bug and showing it has been fixed

@@ -101,7 +101,7 @@
public String getAgentUrl() {
String port = (this.getAgentPort() == 443) ? "" : ":" + this.getAgentPort();
String contextPath = formatContextPath(this.getAgentContextPath());
return CommonConstants.HTTPS_PREFIX + this.getAgentHost() + port + contextPath;
return CommonConstants.HTTPS_PREFIX + this.agentHost + port + contextPath;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't changing the logic? i.e the agent url won't be "load balanced" anymore?

Copy link
Contributor Author

@symphony-elias symphony-elias Aug 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Truth is, I don't know the exact logic here and how to remove the stack overflow error (see my comment on issue APP-2970). So, please advise.
https://github.com/SymphonyPlatformSolutions/symphony-api-client-java/blob/master/symphony-bdk-legacy/symphony-api-client-java/src/main/java/configuration/SymLoadBalancedConfig.java#L98 says : Retrieves actual Agent FQDN (Fully Qualified Domain Name) by calling /agent/v1/info endpoint. so I was assuming we needed the non-load balanced agent host (the one configured in the bot configuration file).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@symphony-elias with this test I was able to reproduce the stack overflow error:

@Test
  public void getAgentHost_stackOverflow() {
    final SymLoadBalancedConfig config = new SymLoadBalancedConfig();
    final LoadBalancing loadBalancing = new LoadBalancing();
    loadBalancing.setMethod(LoadBalancingMethod.external);
    config.setLoadBalancing(loadBalancing);

    assertNotNull(config.getAgentHost());
  }

Not sure this is the exact same configuration as reported in the ticket but this only should not produce a stack overflow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And with your fix I get

java.lang.IndexOutOfBoundsException: Index: 0

at java.util.Collections$EmptyList.get(Collections.java:4456)
at configuration.SymLoadBalancedConfig.rotateAgent(SymLoadBalancedConfig.java:86)
at configuration.SymLoadBalancedConfig.getAgentHost(SymLoadBalancedConfig.java:61)

Will there be only one and only one agentServers defined if the LB method is external?
maybe in that case we can improve the error message if it is not defined

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@symphony-youri Yes we expect to have one and only one item (clarified with Philippe Vialatte). I will add unit tests and add an explicit error message.

@thibauult
Copy link
Member

@symphony-elias We (or I?) recently refactored the SymConfig class to use Lombok for getters and setters. Could it be related?

@symphony-elias
Copy link
Contributor Author

@symphony-elias We (or I?) recently refactored the SymConfig class to use Lombok for getters and setters. Could it be related?

I guess the related change is this one : b110cee#diff-fc189cefbad045bb241cea9622a1f008

@symphony-elias symphony-elias marked this pull request as draft August 27, 2020 12:05
@symphony-elias symphony-elias marked this pull request as ready for review August 28, 2020 12:15
Copy link
Contributor

@symphony-hong symphony-hong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@symphony-elias symphony-elias merged commit e5c8a04 into finos:master Aug 31, 2020
@symphony-elias symphony-elias deleted the APP-2970 branch September 17, 2020 11:50
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.

4 participants