Fix "Finder with name 'xxx' is already registered" on plugin re-registration#9853
Conversation
|
|
…isters finders When a plugin's Spring context partially registers finders then fails (leaving stale entries), subsequent start attempts throw "already registered". Fix by calling unregister(pluginId) at the start of register() to clean up stale state. Also adds tests for register/unregister plugin finders and the re-registration scenario. Agent-Logs-Url: https://github.com/halo-dev/halo/sessions/f07880fa-01f5-40a5-93cf-fc041187c3ed Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
|
|
/cherry-pick release-2.23 |
|
@ruibaby: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ruibaby The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@ruibaby: #9853 failed to apply on top of branch "release-2.23": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherry-pick release-2.23 |
|
@ruibaby: #9853 failed to apply on top of branch "release-2.23": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cherry-pick release-2.23 |
|
@ruibaby: #9853 failed to apply on top of branch "release-2.23": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
…tration (halo-dev#9853) * Initial plan * Fix "Finder with name 'xxx' is already registered" when plugin re-registers finders When a plugin's Spring context partially registers finders then fails (leaving stale entries), subsequent start attempts throw "already registered". Fix by calling unregister(pluginId) at the start of register() to clean up stale state. Also adds tests for register/unregister plugin finders and the re-registration scenario. Agent-Logs-Url: https://github.com/halo-dev/halo/sessions/f07880fa-01f5-40a5-93cf-fc041187c3ed Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
…tration (#9853) (#9876) * Initial plan * Fix "Finder with name 'xxx' is already registered" when plugin re-registers finders When a plugin's Spring context partially registers finders then fails (leaving stale entries), subsequent start attempts throw "already registered". Fix by calling unregister(pluginId) at the start of register() to clean up stale state. Also adds tests for register/unregister plugin finders and the re-registration scenario. Agent-Logs-Url: https://github.com/halo-dev/halo/sessions/f07880fa-01f5-40a5-93cf-fc041187c3ed --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: ruibaby <21301288+ruibaby@users.noreply.github.com>
What type of PR is this?
/kind bug
What this PR does / why we need it:
When a plugin's Spring context fires
ContextRefreshedEvent(registering finders) but is then abandoned without a correspondingContextClosedEvent— e.g., whenfinishRefresh()throws after the event, or when cleanup fails — the finder entries remain stale inDefaultFinderRegistry. The next start attempt (e.g., after a plugin upgrade) throws"Finder with name 'xxxFinder' is already registered", requiring a Halo restart to recover.Fix: Call
unregister(pluginId)at the top ofregister()to evict any stale entries for that plugin before registering new ones. This makes registration idempotent per plugin while still detecting genuine name conflicts across different plugins.Which issue(s) this PR fixes:
Fixes #9798
Special notes for your reviewer:
unregister()on an unknownpluginIdis a no-op (map miss), so this adds zero overhead on normal first-time registration.Does this PR introduce a user-facing change?
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
checkstyle.org/opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.25.1/x64/codeql/xml/tools/xml-extractor.jar --fileList=/tmp/codeql-scratch-dd1d0a2b113c8104/dbs/java/working/files-to-index5977883620544843849.list --sourceArchiveDir=/tmp/codeql-scratch-dd1d0a2b113c8104/dbs/java/src --outputDir=/tmp/codeql-scratch-dd1d0a2b113c8104/dbs/java/trap/java(dns block)If you need me to access, download, or install something from one of these locations, you can either: