Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SDK Java Jersey - Spring Boot - Client Side evaluation - A new JerseyClient created at each request #22

Closed
1 of 5 tasks
MarcRoser opened this issue Jul 8, 2022 · 0 comments · Fixed by #21
Closed
1 of 5 tasks

Comments

@MarcRoser
Copy link

MarcRoser commented Jul 8, 2022

Describe the bug

Discussion featurehub-io/featurehub#805

When ClientContext is use as a request scope bean in Spring Boot, a new JerseyClient is created at each request.
Spring Boot close/destroy/shudown every request scope beans at the end of the requests. This cause the new JerseyClient to be closed and the request to be stuck sometimes a several seconds on edgeService.close() / eventInput.close().

Explanation ;
In FeatureHubConfig:newContext, edgeService is a Supplier<EdgeService> and not a EdgeService.
By default, the implemention of this supplier is :

public class JerseyFeatureHubClientFactory implements FeatureHubClientFactory {
  @Override
  public Supplier<EdgeService> createEdgeService(FeatureHubConfig config, FeatureStore repository) {
    return () -> new JerseyClient(config, repository);
  }
}

Because of this, when the ClientEvalFeatureContext is built inside FeatureHubConfig:newContext, edgeService.get() will provide the constructor with new JerseyClient(config, repository).

Which area does this issue belong to?

  • FeatureHub Admin Web app
  • SDK
  • SDK examples
  • Documentation
  • Other

To Reproduce
With the Spring Boot exemple, make a request.

Expected behavior
Each new ClientEvalFeatureContext should use the repository and the edge service built inside FeatureHubConfig:init, and not be provided with a new one.
Carefull, if this is fixed, the edge service must not be closed in ClientEvalFeatureContext:close

Versions

  • SDK version [e.g. 2.4]
@rvowles rvowles transferred this issue from featurehub-io/featurehub Jul 8, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant