You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apparently there is a memory leak when we remove bean definitions and the cache for their merged bean definition is not clear due to: spring-projects/spring-framework#23336.
The problem has a big impact when random bean names are used for the IntegrationFlowContext interaction.
Need to look into a way to deal with a SingletonBeanRegistry.registerSingleton() instead of a BeanDefinitionRegistry.registerBeanDefinition().
The text was updated successfully, but these errors were encountered:
Fixes: spring-projects#9442
Issue link: spring-projects#9442
When we register a `BeanDefinition`, its metadata is cached in the `DefaultListableBeanFactory.mergedBeanDefinitionHolders`
and it is not removed when we destroy bean.
This causes a memory leak with dynamic integration flows where even we destroy beans, their metadata is still cached.
This has more serious impact when random ids are used for dynamic integration flows.
* Rework `IntegrationFlowContext` logic to register singletons instead of `BeanDefinition`
* Adjust `IntegrationFlowBeanPostProcessor` logic to register singletons or `BeanDefinition`
according to the presence of `BeanDefinition` of the `IntegrationFlow` we are processing
* Introduce `ComponentSourceAware` to mimic a `BeanDefinition` metadata logic for bean source and its description.
This info helps a lot with exceptions where class in the `IntegrationFlow` might be fully from a Spring Integration package.
So, to give a clue what end-user code is related to the exception,
such a `ComponentSourceAware` is there to preserver and transfer "bean source"
* Implement `ComponentSourceAware` in the `IntegrationObjectSupport` since this is a central
place where we generate info for the Spring Integration exceptions
* Implement `ComponentSourceAware` in the `StandardIntegrationFlow` to propagate bean source info
down to its components for the mentioned `IntegrationObjectSupport` logic
* Introduce inner `StandardIntegrationFlowContext.IntegrationFlowComponentSourceAwareAdapter`
to be able to transfer "bean source" info from builder down to the target `IntegrationFlow` bean
More info on StackOverflow: https://stackoverflow.com/questions/78933787/why-does-spring-not-clean-up-integrationflows-for-a-dynamic-tcp-client.
Apparently there is a memory leak when we remove bean definitions and the cache for their merged bean definition is not clear due to: spring-projects/spring-framework#23336.
The problem has a big impact when random bean names are used for the
IntegrationFlowContext
interaction.Need to look into a way to deal with a
SingletonBeanRegistry.registerSingleton()
instead of aBeanDefinitionRegistry.registerBeanDefinition()
.The text was updated successfully, but these errors were encountered: