Closed frzme closed 4 years ago
https://github.com/reactor/reactor-rabbitmq/blob/v1.4.2.RELEASE/src/main/java/reactor/rabbitmq/Sender.java#L965 adds a Shutdown listener to the channel upon subscription of a sendWithPublishConfirms send. This shutdown listener is never removed.
When used together with Channel pooling the Channel objects are long lived and the shutdown listeners remain in memory. As the shutdown listeners reference the subscriptions they keep a lot of objects alive.
In https://github.com/reactor/reactor-rabbitmq/blob/v1.4.2.RELEASE/src/main/java/reactor/rabbitmq/Sender.java#L1054 the confirmListener gets removed. It might be appropriate to also remove the shutdownListener.
Good catch and thanks for the analysis. A PR would be welcome.
Actual Behavior
https://github.com/reactor/reactor-rabbitmq/blob/v1.4.2.RELEASE/src/main/java/reactor/rabbitmq/Sender.java#L965 adds a Shutdown listener to the channel upon subscription of a sendWithPublishConfirms send. This shutdown listener is never removed.
When used together with Channel pooling the Channel objects are long lived and the shutdown listeners remain in memory. As the shutdown listeners reference the subscriptions they keep a lot of objects alive.
Possible Solution
In https://github.com/reactor/reactor-rabbitmq/blob/v1.4.2.RELEASE/src/main/java/reactor/rabbitmq/Sender.java#L1054 the confirmListener gets removed. It might be appropriate to also remove the shutdownListener.