Repository navigation
Conversation
unload() left parts of a module registered and could remove something the module did not own: - Module interceptors are registered as Name@module but were unregistered as Name, so they kept listening. - The module router is registered as an interceptor and was never unregistered. - Alias keys stayed in the modules setting and the module config cache. - Every executor a module declared was shut down, even one the application or another module had created first under the same name. Only executors the module itself created are shut down now. - unloadAll() ran unload() once for the module name and once more for each alias, so onUnload() ran more than once. Each fix has a spec that fails without it.
homestar9
marked this pull request as ready for review
October 27, 2026 22:25
… its own name as an alias The alias check skipped any key found in the module's own aliases. A module whose alias equals its own name (e.g. a module installed under its alias) was then never unloaded, not even at application shutdown. A key of the module registry is a real module name, so it is never skipped.
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.
Description
ModuleService.unload()andunloadAll()did not fully clean up after a module:Name@moduleNamebut were unregistered asName. They are now unregistered with the name they were registered with.Router@moduleNameand was never unregistered. It is now.this.aliasesstayed in themodulessetting and the config cache, pointing at the unloaded module. They are now removed.unload()shut down every executor the module declared, including one the application or another module created first. ColdBox now remembers which executors each module created and only shuts those down.unloadAll()unloaded a module once per alias. Aliases are extra keys pointing at the same module, soonUnload()ran more than once. Alias keys are now skipped, except a module's own name, which some modules also list as an alias.Jira Issues
https://ortussolutions.atlassian.net/browse/COLDBOX-1471
Part of https://ortussolutions.atlassian.net/browse/COLDBOX-1478
Type of change
Checklist
Tests
tests/specs/web/services/ModuleServiceUnloadTest.cfc(new): one spec for each problem above. The test module intests/resources/unloadfixtures/unloadMain/declares an interceptor, a router, an alias and two executors.The 5 specs for the five problems fail on the 8.3.0 code. The sixth, for a module that lists its own name as an alias, passes on 8.3.0 and guards against the mistake in my first version of the fix. Every spec passes on BoxLang, Lucee 5 and 6, and Adobe 2023 and 2025 (GitHub checks).