Repository navigation
fix(register): report the bound server port for gateway instance identity (#7732) - #7861
Merged
Aias00 merged 1 commit intoOct 20, 2026
Merged
Conversation
…tity (apache#7732) Heartbeat, websocket sync, and HTTP long polling wait for the application server's bound port and ignore the management listener. server.port=0 is reported as the ephemeral port that was actually bound, and a missing or non-positive client port is not published. Fixes apache#7732 Co-authored-by: markxu <[email protected]>
Contributor
|
pls add my wechat: aias00 |
Aias00
approved these changes
Oct 20, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Thanks for this change. Reporting the actually-bound listener port instead of the configured server.port (which can be 0 for ephemeral ports) is the correct fix for #7732, and centralizing the rule in BoundServerPort.resolve(...) keeps the heartbeat reporter, HTTP long-polling, and websocket sync consistent.
Highlights:
- Replacing the
ServerProperties-injected port with aWebServerInitializedEventlistener that captures the real bound port is the right approach; theclosedguard correctly lets shutdown win over a late init event. - Good defensive handling: the management namespace and non-positive ports are rejected, and HTTP long-polling now omits
X-Real-PORTentirely when no port is known rather than sending a placeholder0. - The new
BoundServerPortTest,HeartbeatBoundPortTest,HttpSyncBoundPortTestandWebsocketBoundPortTest, plus the updated existing suites, give solid coverage of the ephemeral / fixed / management cases. - Adding
spring-bootas aprovideddependency inshenyu-sync-data-http/pom.xmlcorrectly makes the newly usedWebServerInitializedEventimport explicit.
CI is green (pr_build passing). Approving.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7732
Gateway instance identity now uses the port the application server actually bound, including when
server.port=0. The separate management listener is ignored, and nothing is published until a positive application port is observed.WebServerInitializedEventsupplies a positive application port. Shutdown still cancels that scheduler, and a later initialization event does not start another one.ClientPorthandshake header is the bound port.X-Real-PORTuntil the bound port is known. Admin ignores a missing, zero, or non-numeric client port instead of publishing an empty identity.Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.