Skip to content

Conversation

@gtully
Copy link
Contributor

@gtully gtully commented Jan 30, 2026

…dable config elements

@gtully gtully marked this pull request as draft January 30, 2026 14:50
@gtully
Copy link
Contributor Author

gtully commented Jan 30, 2026

There is a use case where a user has a coded configuration impl that they pass to the broker, if that contains re loadable config and there are the same entries in a properties file that is reloaded, then the reload will take precedence. In this case there are two sources of truth and one is re-loadable, I think this is the expected behaviour, but due to this bug, it is not currently the case.

@gemmellr
Copy link
Member

gemmellr commented Feb 2, 2026

There is a use case where a user has a coded configuration impl that they pass to the broker, if that contains re loadable config and there are the same entries in a properties file that is reloaded, then the reload will take precedence. In this case there are two sources of truth and one is re-loadable, I think this is the expected behaviour, but due to this bug, it is not currently the case.

It wont just 'take precedence', it could silently toss original configuration even where they dont overlap at all, giving potentially a completely different result than when the very same properties were applied at startup. So even touching the file could alter config vs startup, which itself seems like an issue.

FWIW, you added a startup class for use with images thats specifically using that behaviour, and added ability to change the properties path on another related embedding class that then allows it too, so youll likely need to look at updating those, and some of the tests that use it, if you want to change this.

@gtully gtully marked this pull request as ready for review February 3, 2026 13:26
@gtully
Copy link
Contributor Author

gtully commented Feb 3, 2026

configurationFileRefreshPeriod=-1 is necessary if there are multiple source of truth for config that supports reload.

@gtully
Copy link
Contributor Author

gtully commented Feb 3, 2026

@gemmellr I peeked at the image example tests, none have overlapping re-loadable config. I cannot find any broken usage in our test suite.

@gtully gtully requested review from gemmellr and tabish121 February 3, 2026 16:58
configuration.parseProperties(propertiesFileUrl);
config.parseProperties(propertiesFileUrl);
configuration.setStatus(config.getStatus());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to disregard any configuration that was assigned programmatically via an initial configuration object when it sets the configuration from the reload of the possible XML file and then the properties file. It creates an empty configuration vessel which it might fill in from XML and or a properties file(s) set and then hard sets those entries into the existing configuration regardless of the differences between old and new which could lose original data. Its not clear when or why these differing configuration sets take precedence over each other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is exactly the intent, the new config is just for the purpose of being reloaded by the reload logic. There is currently no callback for programatic config. Typically broker config is read once at startup. The reload logic is restricted to the set of accessors that support reload, the bits that are copied over after a config is reread. Then the deployReloadableConfigFromConfiguration method does the heavy lifting of applying any changes or not to individual components.

So the difference check is all in deployReloadableConfigFromConfiguration

@gemmellr
Copy link
Member

gemmellr commented Feb 4, 2026

@gemmellr I peeked at the image example tests, none have overlapping re-loadable config. I cannot find any broken usage in our test suite.

The config doesnt actually need to 'overlap' for it to be a problem, its arguably even more of an issue when it doesnt as then the original certainly shouldnt be getting tossed.

The issue is also not going to be contained to our test suite.

We provide multiple APIs that allow providing Configuration objects, even encourage it, or always do it. Your changes dont even try to stop that, they'll just make it silently do something egregiously different than before.

@gemmellr I peeked at the image example tests, none have overlapping re-loadable config. I cannot find any broken usage in our test suite.

Again, this is not an issue contained to our test suite.

Check out the main ActiveMQServerImpl constructors, or the 'Main' which do supply a Configuration, or EmbeddedActiveMQ which it uses and similarly can or will do the same, and is used in various other places to that end.

@gemmellr
Copy link
Member

gemmellr commented Feb 4, 2026

configurationFileRefreshPeriod=-1 is necessary if there are multiple source of truth for config that supports reload.

This has never been a stated requirement and still wouldnt be enforced (which it should be if its a requirement), and I know you originally added the broker properties to use in a situation there were specifically multiple sources (with updates to each targeting different configuration areas, i.e not overlapping) so that seems strange to say now. I can see it causes problems for your current changes, but I dont think silently breaking stuff that has been working is necessarily the way to go. I also think what these changes would seem to allow in later silently tossing startup configuration would be a worse bug than any consideration of the way it currently behaves as being a bug.

@gtully
Copy link
Contributor Author

gtully commented Feb 4, 2026

This is not a change of expected behaviour, config reload has always tossed startup config. That is how it works, such that the config taken at startup can be compared to the new config.
It has never been the case that programmatic config is safe from config reload.
disabling config reload is only necessary if you don't want reload to take precedence.

@gemmellr
Copy link
Member

gemmellr commented Feb 4, 2026

This is not a change of expected behaviour, config reload has always tossed startup config. That is how it works, such that the config taken at startup can be compared to the new config. It has never been the case that programmatic config is safe from config reload. disabling config reload is only necessary if you don't want reload to take precedence.

We have a different definition of 'change' then. It has been the case that programmatic config which hasnt changed by the properties has been safe from properties config reload previously, given the way the properties config [reload] always worked at startup and later. It plays partly into the same space that meant you previously added a mechanism that allow 'unsetting' existing config by adding a 'removal property' value, which is partly what you look to be trying to change here.

@gtully
Copy link
Contributor Author

gtully commented Feb 4, 2026

I don't get the "silently breaking what has been working", it is fixing what has not been working.
the whole, I have passed in a config object use case, with config reload, that is never a flyer. Config sets the bits that can later be reloaded. The broker properties not applying to that config was a bug.

@gemmellr
Copy link
Member

gemmellr commented Feb 4, 2026

It doesnt make sense for config reload with the same unchanged config properties to result in a different effective config than startup does from the very same config/properties. Yet for a provided Configuration thats something your changes can do, throwing away the initial configuration in the reloadable sections, totally unlike it does at startup, and unlike what it did before. Thats a far worse behaviour than anything.

The embedded "Main" class that was initially aimed at usage with properties to add additional config, to some existing config. That for example supplies the initial broker config as a Configuration object (loaded from an XML file, but not by the broker itself). It uses the EmbeddedActiveMQ to do that, which you also added support for providing a specified properties to go with existing base provided Configuration. The broker itself has for years automatically loaded a properties file (if found) at startup and applies it as additional configuration to whatever the existing passed in (or parsed) Configuration was. Your change will take those same configuration details at reload, potentially completely unchanged, and then do something entirely different with it by tossing the original Configuration in the reloadable sections and using only the effect of the properties alone, resulting in a completely different effective config from the same starting configuration details even though noe of them actually changed.

Something that is currently functioning in a reasonably expected manner, in the way it always worked, and changes to do something thats quite unexpected, and doesnt even say its doing it. Thats what I mean by silently breaking what has been working.

@gtully
Copy link
Contributor Author

gtully commented Feb 4, 2026

I agree that config reload with a provided programmatic config is broken. There are no callbacks and have been no callbacks for programmatic config to get reapplied.

That is not an argument for not restricting the reload of properties config to re loadable components.

The fact that the effective config was changing on reload is irrelevant unless something reads the new config. The only thing that rereads config are the components that support config reload when they are poked on reload.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants