spring-cloud / spring-cloud/spring-cloud-commons
Provide deterministic behavior when management.server.port=0
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
As observed in https://github.com/spring-cloud/spring-cloud-consul/issues/555, when using management.server.port = 0 calls to ManagementServerPortUtils.getPort return 0, rather than the dynamic assigned address.
Not sure of the official solution for this, but can ManagementServerPortUtils be extended to add an ApplicationEvent listener and update the port if / when dynamic ports are being used.
Granted there is a potential for a sort-of-race condition here, where a caller might try and get the port value before the application event has fired, but in my experience, the actuator events usually fire before the main application starts.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review ManagementServerPortUtils alongside issue #555 and open pull request #562 first. Check how management.server.port=0 is resolved and whether the reported value becomes the dynamically assigned address; done means getPort no longer returns 0 for that configuration while accounting for the event-order concern described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100