You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Scott Stanton (JIRA)" <ji...@apache.org> on 2008/07/08 00:22:00 UTC

[jira] Created: (AMQ-1842) HashIndex leaks file handles when destination is removed

HashIndex leaks file handles when destination is removed
--------------------------------------------------------

                 Key: AMQ-1842
                 URL: https://issues.apache.org/activemq/browse/AMQ-1842
             Project: ActiveMQ
          Issue Type: Bug
          Components: Message Store
    Affects Versions: 5.2.0
            Reporter: Scott Stanton
            Priority: Critical


When a destination is removed, all open file handles inside HashIndex will be leaked because HashIndex.clear() closes the index, deletes the backing store files, then reopens the files.  There is no provision for closing the HashIndex without reopening the files.  Eventually the broker runs out of file handles and hangs.

For reference, here is the stack trace down to HashIndex.clear from the removeDestination call:

{code}
	  at org.apache.activemq.kaha.impl.index.hash.HashIndex.clear(HashIndex.java:313)
	  at org.apache.activemq.kaha.impl.container.MapContainerImpl.clear(MapContainerImpl.java:385)
	  at org.apache.activemq.store.kahadaptor.KahaReferenceStore.removeAllMessages(KahaReferenceStore.java:201)
	  at org.apache.activemq.store.kahadaptor.KahaTopicReferenceStore.removeAllMessages(KahaTopicReferenceStore.java:320)
	  at org.apache.activemq.store.amq.AMQMessageStore.removeAllMessages(AMQMessageStore.java:503)
	  at org.apache.activemq.broker.region.Topic.dispose(Topic.java:452)
	  at org.apache.activemq.broker.region.AbstractRegion.dispose(AbstractRegion.java:469)
	  at org.apache.activemq.broker.region.AbstractRegion.removeDestination(AbstractRegion.java:185)
	  at org.apache.activemq.broker.region.RegionBroker.removeDestination(RegionBroker.java:289)
	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
	  at org.apache.activemq.advisory.AdvisoryBroker.removeDestination(AdvisoryBroker.java:173)
	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
...
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQ-1842) HashIndex leaks file handles when destination is removed

Posted by "Scott Stanton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Stanton updated AMQ-1842:
-------------------------------

    Attachment: patches

The attached patch attempts to resolve this issue by removing the state associated with a destination when it is removed.

> HashIndex leaks file handles when destination is removed
> --------------------------------------------------------
>
>                 Key: AMQ-1842
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1842
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.2.0
>            Reporter: Scott Stanton
>            Priority: Critical
>         Attachments: patches
>
>
> When a destination is removed, all open file handles inside HashIndex will be leaked because HashIndex.clear() closes the index, deletes the backing store files, then reopens the files.  There is no provision for closing the HashIndex without reopening the files.  Eventually the broker runs out of file handles and hangs.
> For reference, here is the stack trace down to HashIndex.clear from the removeDestination call:
> {code}
> 	  at org.apache.activemq.kaha.impl.index.hash.HashIndex.clear(HashIndex.java:313)
> 	  at org.apache.activemq.kaha.impl.container.MapContainerImpl.clear(MapContainerImpl.java:385)
> 	  at org.apache.activemq.store.kahadaptor.KahaReferenceStore.removeAllMessages(KahaReferenceStore.java:201)
> 	  at org.apache.activemq.store.kahadaptor.KahaTopicReferenceStore.removeAllMessages(KahaTopicReferenceStore.java:320)
> 	  at org.apache.activemq.store.amq.AMQMessageStore.removeAllMessages(AMQMessageStore.java:503)
> 	  at org.apache.activemq.broker.region.Topic.dispose(Topic.java:452)
> 	  at org.apache.activemq.broker.region.AbstractRegion.dispose(AbstractRegion.java:469)
> 	  at org.apache.activemq.broker.region.AbstractRegion.removeDestination(AbstractRegion.java:185)
> 	  at org.apache.activemq.broker.region.RegionBroker.removeDestination(RegionBroker.java:289)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.advisory.AdvisoryBroker.removeDestination(AdvisoryBroker.java:173)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> ...
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-1842) HashIndex leaks file handles when destination is removed

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-1842.
-----------------------------

    Resolution: Fixed

Fixed by SVN revision 729939, 729940, 729942

> HashIndex leaks file handles when destination is removed
> --------------------------------------------------------
>
>                 Key: AMQ-1842
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1842
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.2.0
>            Reporter: Scott Stanton
>            Assignee: Rob Davies
>            Priority: Critical
>             Fix For: 5.3.0
>
>         Attachments: patches
>
>
> When a destination is removed, all open file handles inside HashIndex will be leaked because HashIndex.clear() closes the index, deletes the backing store files, then reopens the files.  There is no provision for closing the HashIndex without reopening the files.  Eventually the broker runs out of file handles and hangs.
> For reference, here is the stack trace down to HashIndex.clear from the removeDestination call:
> {code}
> 	  at org.apache.activemq.kaha.impl.index.hash.HashIndex.clear(HashIndex.java:313)
> 	  at org.apache.activemq.kaha.impl.container.MapContainerImpl.clear(MapContainerImpl.java:385)
> 	  at org.apache.activemq.store.kahadaptor.KahaReferenceStore.removeAllMessages(KahaReferenceStore.java:201)
> 	  at org.apache.activemq.store.kahadaptor.KahaTopicReferenceStore.removeAllMessages(KahaTopicReferenceStore.java:320)
> 	  at org.apache.activemq.store.amq.AMQMessageStore.removeAllMessages(AMQMessageStore.java:503)
> 	  at org.apache.activemq.broker.region.Topic.dispose(Topic.java:452)
> 	  at org.apache.activemq.broker.region.AbstractRegion.dispose(AbstractRegion.java:469)
> 	  at org.apache.activemq.broker.region.AbstractRegion.removeDestination(AbstractRegion.java:185)
> 	  at org.apache.activemq.broker.region.RegionBroker.removeDestination(RegionBroker.java:289)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.advisory.AdvisoryBroker.removeDestination(AdvisoryBroker.java:173)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> ...
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (AMQ-1842) HashIndex leaks file handles when destination is removed

Posted by "Scott Stanton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44131#action_44131 ] 

snstanton edited comment on AMQ-1842 at 7/9/08 6:20 PM:
------------------------------------------------------------

The attached patch attempts to resolve this issue by removing the state associated with a destination when it is removed.  Note that this patch resolves the issue for the Kaha message store, but does not attempt to resolve it for other message store types.

Summary of changes:

* Changed BaseDestination.dispose() to call dispose() on the MessageStore.
* Added Index.delete() method.
* Factored out AbstractMessageStore to hold the destination and the default implementations of various methods.
* Added dispose() to the MessageStore interface with implementations for KahaReferenceStore and KahaTopicReferenceStore that delete the messageContainer and subscriberContainer.
* Added KahaReferenceStoreAdapter.removeReferenceStore() that drops references to a message store that is being deleted.
* Added MapContainer.delete() with implementations for all three container types.

      was (Author: snstanton):
    The attached patch attempts to resolve this issue by removing the state associated with a destination when it is removed.
  
> HashIndex leaks file handles when destination is removed
> --------------------------------------------------------
>
>                 Key: AMQ-1842
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1842
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.2.0
>            Reporter: Scott Stanton
>            Priority: Critical
>         Attachments: patches
>
>
> When a destination is removed, all open file handles inside HashIndex will be leaked because HashIndex.clear() closes the index, deletes the backing store files, then reopens the files.  There is no provision for closing the HashIndex without reopening the files.  Eventually the broker runs out of file handles and hangs.
> For reference, here is the stack trace down to HashIndex.clear from the removeDestination call:
> {code}
> 	  at org.apache.activemq.kaha.impl.index.hash.HashIndex.clear(HashIndex.java:313)
> 	  at org.apache.activemq.kaha.impl.container.MapContainerImpl.clear(MapContainerImpl.java:385)
> 	  at org.apache.activemq.store.kahadaptor.KahaReferenceStore.removeAllMessages(KahaReferenceStore.java:201)
> 	  at org.apache.activemq.store.kahadaptor.KahaTopicReferenceStore.removeAllMessages(KahaTopicReferenceStore.java:320)
> 	  at org.apache.activemq.store.amq.AMQMessageStore.removeAllMessages(AMQMessageStore.java:503)
> 	  at org.apache.activemq.broker.region.Topic.dispose(Topic.java:452)
> 	  at org.apache.activemq.broker.region.AbstractRegion.dispose(AbstractRegion.java:469)
> 	  at org.apache.activemq.broker.region.AbstractRegion.removeDestination(AbstractRegion.java:185)
> 	  at org.apache.activemq.broker.region.RegionBroker.removeDestination(RegionBroker.java:289)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.advisory.AdvisoryBroker.removeDestination(AdvisoryBroker.java:173)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> ...
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (AMQ-1842) HashIndex leaks file handles when destination is removed

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies reassigned AMQ-1842:
-------------------------------

    Assignee: Rob Davies

> HashIndex leaks file handles when destination is removed
> --------------------------------------------------------
>
>                 Key: AMQ-1842
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1842
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Message Store
>    Affects Versions: 5.2.0
>            Reporter: Scott Stanton
>            Assignee: Rob Davies
>            Priority: Critical
>         Attachments: patches
>
>
> When a destination is removed, all open file handles inside HashIndex will be leaked because HashIndex.clear() closes the index, deletes the backing store files, then reopens the files.  There is no provision for closing the HashIndex without reopening the files.  Eventually the broker runs out of file handles and hangs.
> For reference, here is the stack trace down to HashIndex.clear from the removeDestination call:
> {code}
> 	  at org.apache.activemq.kaha.impl.index.hash.HashIndex.clear(HashIndex.java:313)
> 	  at org.apache.activemq.kaha.impl.container.MapContainerImpl.clear(MapContainerImpl.java:385)
> 	  at org.apache.activemq.store.kahadaptor.KahaReferenceStore.removeAllMessages(KahaReferenceStore.java:201)
> 	  at org.apache.activemq.store.kahadaptor.KahaTopicReferenceStore.removeAllMessages(KahaTopicReferenceStore.java:320)
> 	  at org.apache.activemq.store.amq.AMQMessageStore.removeAllMessages(AMQMessageStore.java:503)
> 	  at org.apache.activemq.broker.region.Topic.dispose(Topic.java:452)
> 	  at org.apache.activemq.broker.region.AbstractRegion.dispose(AbstractRegion.java:469)
> 	  at org.apache.activemq.broker.region.AbstractRegion.removeDestination(AbstractRegion.java:185)
> 	  at org.apache.activemq.broker.region.RegionBroker.removeDestination(RegionBroker.java:289)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.advisory.AdvisoryBroker.removeDestination(AdvisoryBroker.java:173)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> 	  at org.apache.activemq.broker.BrokerFilter.removeDestination(BrokerFilter.java:146)
> 	  at org.apache.activemq.broker.MutableBrokerFilter.removeDestination(MutableBrokerFilter.java:153)
> ...
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.