Repository navigation
fix(admin): ignore the management server in the startup listener - #7789
Open
Sean-Walker0 wants to merge 1 commit into
Open
Sean-Walker0 wants to merge 1 commit into
Sean-Walker0 wants to merge 1 commit into
Conversation
ApplicationStartListener handled every WebServerInitializedEvent, so when the actuator management server (namespace "management") started on its own port, the listener called shenyuRunningModeService.start a second time with that port: standalone mode re-ran the checker setup and cluster mode scheduled an extra recurring election task. Skip events whose application context server namespace is "management". Regression test delivers a management-namespace ServletWebServerInitializedEvent and asserts the running mode service is never started for it (red on the previous code, which started it with the management port). Fixes apache#7775
Aias00
approved these changes
Oct 18, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Approved.
Correct fix. When a separate management (actuator) server is enabled, Spring fires a second WebServerInitializedEvent for it; the previous code re-ran the running-mode setup on that event, scheduling a duplicate election task bound to the management port. Narrowing on ServletWebServerInitializedEvent with server namespace "management" and returning early avoids the duplicate setup. The new testIgnoresManagementServerEvent test asserts start() is never called for that event.
CI is green on this branch.
This branch has not been deployed
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 #7775
Modifications
ApplicationStartListenerhandled everyWebServerInitializedEvent, so when the actuator management server (namespace"management") started on its own port, the listener calledshenyuRunningModeService.start(host, managementPort, contextPath)a second time. In standalone mode this re-runs the checker setup; in cluster mode it schedules an extra recurring election task — both for a port that is not an Admin endpoint.Events whose application context server namespace is
"management"are now skipped:The main server event (no namespace /
"server") keeps the existing behavior unchanged.Verifying this change
ApplicationStartListenerTest#testIgnoresManagementServerEvent— delivers a management-namespaceServletWebServerInitializedEventand assertsshenyuRunningModeService.startis never invoked for it. Red on the pre-fix code (the service was started with the management port, matching the issue's two-event reproduction), green after../mvnw -pl shenyu-admin -am test -B -Dtest=ApplicationStartListenerTest— 4/4 green (3 pre-existing cases unchanged), module checkstyle clean.Notes
startcall for the management port no longer happens — that call had no valid purpose (the management server is a side-channel, not another Admin instance).ApplicationStartListener(verified against the file lists of all 106 open PRs).Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true(module-scoped:shenyu-admintargeted test class + checkstyle green; full-module suite left to CI as with the other admin PRs).