Only link with name equals to subscription name is deleted from the link registry on unsubscribe of shared durable subscription. The other shared durable subscription links with names containing index are left in link registry forever. As result, such links can accumulate with time and cause OOM.
The steps to reproduce
- Apply patch from
- Start the Broker
- Create shared durable subscriptions with 2 subscribers
- Close subscribers and unsubscribe the subscription
- Dump the link registry state using management operation QueueManagingVirtualHost#dumpLinkRegistry . The link for the second shared subscriber will be present in the dumped data