Aias00 opened a new issue, #7732:
URL: https://github.com/apache/shenyu/issues/7732

   ## Current behavior
   Independent `HeartbeatListener` starts a periodic reporter from its 
constructor and fills `instancePort` from `ServerProperties.getPort()`. The 
WebSocket sync service likewise passes `serverProperties.getPort()` into its 
client. These are configured values rather than the port actually bound by the 
running web server.
   
   When `server.port=0`, the server obtains a real ephemeral port, but the 
report/client header carries 0. Admin identity includes the reported port, so 
instance information cannot identify the actual listener and multiple processes 
behind the same reported address can collide. The independent reporter also 
schedules immediately, before receiving a server-initialized event.
   
   ## Source evidence
   - [Independent reporter initialization and 
report](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-register-center/shenyu-register-client-beat/src/main/java/org/apache/shenyu/register/client/beat/HeartbeatListener.java#L74)
   - [WebSocket client 
construction](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-sync-data-center/shenyu-sync-data-websocket/src/main/java/org/apache/shenyu/plugin/sync/data/websocket/WebsocketSyncDataService.java#L206)
   - [Admin instance 
identity](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/InstanceCheckService.java#L106)
   
   ## Acceptance criteria
   - [ ] Use the actual bound application-server port after server 
initialization; account for a distinct management port without reporting it as 
the gateway listener.
   - [ ] Do not publish a placeholder port before initialization. Define 
startup/stop ordering and reject invalid/unavailable port observations 
consistently.
   - [ ] Integration-test `server.port=0` and explicit fixed ports for the 
independent and WebSocket paths; verify two processes receive distinct 
appropriate identities.
   - [ ] Audit the HTTP sync path for the same configuration-versus-bound-port 
assumption and explicitly cover it if affected.
   - [ ] Preserve reporting shutdown/cancellation and avoid adding a second 
heartbeat scheduler.
   
   Source-based finding; no ephemeral-port deployment was run during issue 
preparation. Related: #7696 corrects the instance type, and #7718 defines 
richer instance identity/readiness; neither supplies the actual bound port.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to