Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Invalid
-
None
-
None
-
None
-
None
Description
If a component, such as a Channel or a Sink, throws a RuntimeException (such as IllegalArgumentException or IllegalStateException) in its configure() method to indicate an error, some strange, non-deterministic stuff happens to the rest of the components in the system according to the ordering of the components in the configuration properties hash.
Example:
1. Channel throws IllegalArgumentException in configure() method
2. Throw propagates to PropertiesFileConfigurationProvider.loadChannels(), not caught inside loop (some components not configured)
3. Propagates to load() method in same class, Sources/Sinks not configured, RuntimeException not caught
4. Ends up getting all the way to the AbstractFileConfigurationProvider$FileWatcherRunnable.run() method, which simply logs an error message("Failed to load configuration data. Exception follows.") with a stack trace and continues. So the components will get started, etc.
The behavior should probably be changed to something like the following:
1. Exception should be caught and logged at the PropertiesFileConfigurationProvider.loadChannels() level (along with each other component type such as Source, Sink, etc).
2. At the beginning of PropertiesFileConfigurationProvider.loadChannels(), we should call conf.getChannels.clear() and only add the components to the conf hashes if they were indeed configured successfully. Either that, or at least set them to an unconfigured state that the start routine needs to respect so avoid starting unconfigured or misconfigured components.
This work needs to be done carefully to avoid any unintended consequences of changing this core logic.