spring-cloud / spring-cloud/spring-cloud-commons

Provide deterministic behavior when management.server.port=0

Open
#561 7 comments 0 reactions 0 assignees View on GitHub

@chriswhite199 is already working on this.

Since May 1, 2019.

  • #562 by @chriswhite199 — open
task
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.