Aias00 opened a new issue, #7775: URL: https://github.com/apache/shenyu/issues/7775
## Problem `ApplicationStartListener` handles every `WebServerInitializedEvent` and calls `shenyuRunningModeService.start(host, eventPort, contextPath)` without filtering the server namespace or owning application context. When a separate management server supplies its initialization event, the listener treats that management port as another Admin startup. Repeated standalone starts call checker setup again, and cluster starts schedule an additional recurring election task on the same service. Neither startup path is guarded here. Impact on election publication depends on event ordering and mode; a wrong advertised master port has not been demonstrated in a deployed environment. ## Verified reproduction Current listener source recompiled at `66d7d954ca37d651a5ad916f988a8081157a7ab4`, Java 17. Deliver two actual Spring `ServletWebServerInitializedEvent` objects: application context/9095, then a child context whose namespace is `management`/9096. A capturing running-mode implementation records invocations. Observed: two start calls, with ports `[9095, 9096]`. This verifies listener dispatch semantics; the probe does not start two embedded web servers or assert that every deployment emits this event pair. ## Evidence - [Unfiltered listener](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/ApplicationStartListener.java#L33) - [Standalone starts background checkers](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/mode/standalone/ShenyuStandaloneService.java#L41) - [Cluster schedules election on each start](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/mode/cluster/service/ShenyuClusterService.java#L66) - [Instance checker setup replaces its executor reference without a repeated-start guard](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/InstanceCheckService.java#L85) ## Acceptance criteria - [ ] Initialize running mode only for the intended Admin application server; ignore management/unrelated child-server events. - [ ] Prevent duplicate initialization from repeated eligible events, with an explicit supported restart policy. - [ ] Listener tests cover application/management event order and repeated events. - [ ] Add a Spring Boot regression using a separate management port; assert the advertised application port and one active checker/election schedule. - [ ] Preserve normal fixed/random application-port behavior and orderly shutdown without orphaned executors. Related: #7732 concerns gateway reporting of configured instead of bound ports; this issue is Admin startup reacting to the wrong server event. #6495 concerns election exceptions, not duplicate initialization. -- 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]
