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

Config not loaded properly when instantiating InetUtils in HostInfoEnvironmentPostProcessor #1233

Closed
CC007 opened this issue May 7, 2023 · 16 comments · Fixed by #1333
Closed
Assignees
Labels
Milestone

Comments

@CC007
Copy link

CC007 commented May 7, 2023

When org.springframework.cloud.client.HostInfoEnvironmentPostProcessor (on line 60) is trying to use the config from spring.cloud.inetutils for the instantiation of org.springframework.cloud.commons.util.InetUtils, the config isn't loaded correctly.

InetUtils in org.springframework.cloud.commons.util.UtilAutoConfiguration doesn't seem to have the same issue, because that one seems to get fully initialized before use.

This leads to a significant startup delay, because I'm using a vEthernet (External switch) adapter from hyper-v to route my internet (this was needed to get LAN IP addresses for my hyper-v VMs).
Adding...

spring:
  cloud:
    inetutils:
      preferred-networks:
        - 192.168

...should have fixed this, but due to the config not getting picked up in the post processor, the startup delay is not fully prevented.

spring-cloud-commons version: 4.0.2
sample project: https://github.com/CodeQualIT/CQITFunctions

@CC007
Copy link
Author

CC007 commented May 7, 2023

For clarification, the delay is caused by a timeout in InetUtils on line 167 in the method convertAddress(...)

hostname = result.get(this.properties.getTimeoutSeconds(), TimeUnit.SECONDS);

@OlgaMaciaszek
Copy link
Collaborator

Thanks for reporting this @CC007. Will try to get to it this week.

@CC007
Copy link
Author

CC007 commented May 8, 2023

Thanks!

@CC007
Copy link
Author

CC007 commented May 8, 2023

You probably already saw, but the provided git repo is the same as the one from issue spring-cloud/spring-cloud-openfeign#860

If you run it without the "native" profile, you won't have the problems from that issue. That'll make it easier to manage those issues separately.

@OlgaMaciaszek
Copy link
Collaborator

Hello @CC007. There are many different modules in that repo. I do not see any properties in https://github.com/CodeQualIT/CQITFunctions/tree/master/pocs/boxedhello-project/boxedhello-generated/boxedhello-clients/boxedhello-helloworld-client; or is this a different module that should be used to reproduce it? Could you maybe provide a minimal sample containing only the modules necessary to reproduce the issue, as well as reproduction steps.

@CC007
Copy link
Author

CC007 commented May 11, 2023

You can start the app here: https://github.com/CodeQualIT/CQITFunctions/blob/master/pocs/boxedhello-minimal-project/boxedhello-minimal-app/src/main/java/nl/cqit/function/poc/java/boxedhello/Main.java

The endpoint can be called on localhost:8090

Example call:

POST http://localhost:8090/boxedHello
Content-Type: application/json

{
  "firstName": "Olga",
  "lastName": "Maciaszek"
}

This app uses a feign client that connects to the HelloWorld app (https://github.com/CodeQualIT/CQITFunctions/tree/master/pocs/helloworld-project), which can be started here: https://github.com/CodeQualIT/CQITFunctions/blob/master/pocs/helloworld-project/helloworld-generated/helloworld-app/src/main/java/nl/cqit/function/poc/java/helloworld/Main.java

That app listens on localhost:8080

Example call:

POST http://localhost:8080/helloWorld
Content-Type: application/json

{
  "firstName": "Olga",
  "lastName": "Maciaszek"
}

@CC007
Copy link
Author

CC007 commented May 26, 2023

Any progress regarding this issue?

@OlgaMaciaszek
Copy link
Collaborator

Hi @CC007 , we will take a look at this issue, but it's not high priority, so it will take us some time to get to it.

@CC007
Copy link
Author

CC007 commented Jun 1, 2023

Is there any place where I can see the progress and prioritization of these issues?

@OlgaMaciaszek
Copy link
Collaborator

Here. If it's assigned to a project, project assignment labels and milestones will be added. Any relevant discussion will also happen here.

@CC007
Copy link
Author

CC007 commented Jul 5, 2023

Due to startup time being very important for cloud applications that scale down to 0 running instances, this is a blocking issue for me. With that in mind, could you please reconsider the priority?

@CC007
Copy link
Author

CC007 commented Sep 30, 2023

any updates on this issue?

@OlgaMaciaszek
Copy link
Collaborator

Thanks for the sample, @CC007. I was able to reproduce the issue. We'll look into it.

@OlgaMaciaszek
Copy link
Collaborator

Config resource application.yaml is not listed in the Environment's property sources during the HostiInfoEnvironmentPostProcessor execution, but is there when UtilAutoConfiguration is instantiated.

@OlgaMaciaszek OlgaMaciaszek moved this to In Progress in 2023.0.1 Feb 7, 2024
@OlgaMaciaszek OlgaMaciaszek added this to the 4.1.2 milestone Feb 7, 2024
@OlgaMaciaszek OlgaMaciaszek linked a pull request Feb 8, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from In Progress to Done in 2023.0.1 Feb 8, 2024
@CC007
Copy link
Author

CC007 commented May 4, 2024

Confirmed that I now have a startup time of 0.091s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants