You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by pkorwar <pk...@yahoo.com> on 2013/07/12 18:50:50 UTC

Messages stuck in pending state in queue

Hi all,
I have read several of the threads where people experienced messages stuck
in pending state in queues.
I see that ActiveMQ from version 5.1 onward has this issue. Has this ever
been fixed?

I am also experiencing the same now. The incoming message flow rate is very
minimal. I have registered 5 consumers on persistent queue (Oracle jdbc).
The messages go into the queue quite randomly. I have not seen any pattern
as to when the messages are sent to the pending state.

Is there a fix for this? Is there any version after 5.0 where this pending
messages problem does not exist?
Please help.


Thanks
Pramod




--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
I am using 5.8.0 now.

pramod



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669245.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
I also thought so, but creating the ConnectionFactory repeatedly has caused
the issues for me.
It is very easy to reproduce. Just put the creation of ConnectionFactory  in
a loop and send
messages from the connections obtained. You will be able to reproduce if my
observation is correct with ActiveMQ 5.8

Thanks
Pramod



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669390.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by Christian Posta <ch...@gmail.com>.
You should write a test that shows this is the case.
Creating the connection factory in a script like you describe shouldn't
have anything to do with messages becoming queued up in a destination.


On Tue, Jul 16, 2013 at 2:34 PM, pkorwar <pk...@yahoo.com> wrote:

> Yes, after 2 days of testing, the messages are not getting stuck in a
> pending
> state.
> So, this means that, creating and destroying the ActiveMQConnectionFactory
> repeatedly is
> creating some problems. So, this should be either documented or fixed so
> that
> users won't get caught in a situation where it is very hard to recognize
> the
> problem
> in the first place !
>
> Thanks
> Pramod
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669379.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
Yes, after 2 days of testing, the messages are not getting stuck in a pending
state.
So, this means that, creating and destroying the ActiveMQConnectionFactory
repeatedly is 
creating some problems. So, this should be either documented or fixed so
that
users won't get caught in a situation where it is very hard to recognize the
problem
in the first place !

Thanks
Pramod



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669379.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
I think I know the problem for the pending messages. I will confirm in 2 days
since I need to more time to test before I can exactly tell that this was
the problem.
Somebody else should test this, and try to reproduce it. 

Here is the scenario.

I have 2 types of jms clients. One client resides in code deployed in war
file on jetty server.
It collects some data from some other data source every 'x' secs. If there
is
a threshold exceeded on some value of a field, it sends a JMS message to the
queue
to raise an alarm. So, since the code is deployed in a war file,
ActiveMQConnectionFactory 
was created once and used later to create connection, session etc.

There is another client of JMS which was called from a script. The script
called a simple
java client which created a JMS message and sent it to a jms queue. Since
this does not
reside on any webserver/appserver, the QueueConnectionFactory was created
every time
the script was invoked. This in my opinion caused the problem since it was
repeatedly
creating the ActiveMQConnectionFactory, a huge object.

Solution: I moved the jms sender code to war file deployed on jetty server.
I implemented
a web service which would send the jms message to the queue. The script
which calls the
java program now became a web service client which send the jms message. So,
since the
code sits on jetty, the ActiveMQConnectionFactory is initialized once and
used over and over 
again to create sessions etc.

I have tested it for over a couple of hours, and have sent more than 100
messages from the
2 clients together, and I have not seen a pending message yet. 

I am hoping that  this was the problem!

Thanks for all your help.

Pramod



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669261.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by Mohit Anchlia <mo...@gmail.com>.
Do they ever get picked up i.e if you reconnect consumers?

Sent from my iPhone

On Jul 13, 2013, at 12:09 PM, pkorwar <pk...@yahoo.com> wrote:

> Yes, consumers are alive when the messages are stuck !
> 
> Thanks
> Pramod
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669249.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
Yes, consumers are alive when the messages are stuck !

Thanks
Pramod



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669249.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
Mohit,
Thanks for helping me!
Here are the params I set after going through several forum threads where
their messages were stuck.

Pramod
-------------------
<beans
  xmlns="http://www.springframework.org/schema/beans"
  xmlns:amq="http://activemq.apache.org/schema/core"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
  http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd">

    
    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <value>file:${activemq.conf}/credentials.properties</value>
        </property>
    </bean>
 	<bean id="oracle-ds"
               class="org.apache.commons.dbcp.BasicDataSource"
               destroy-method="close">
               <property name="driverClassName">
                         <value>oracle.jdbc.driver.OracleDriver</value>
               </property>
               <property name="url">
                         <value>jdbc:oracle:thin:@esn-mgr:1521:xyzdb</value>
               </property>
               <property name="username">
                         <value>xyz</value>
               </property>
               <property name="password">
                         <value>xyz</value>
               </property>
               <property name="maxActive">
                         <value>100</value>
               </property>
               <property name="poolPreparedStatements">
                         <value>true</value>
               </property>
         </bean>

    
    <broker xmlns="http://activemq.apache.org/schema/core"
brokerName="localhost" dataDirectory="${activemq.data}">

        

        <destinationPolicy>
            <policyMap>
              <policyEntries>
                <policyEntry topic=">" producerFlowControl="true">
                    
                  <pendingMessageLimitStrategy>
                    <constantPendingMessageLimitStrategy limit="1000"/>
                  </pendingMessageLimitStrategy>
                </policyEntry>
              
		<policyEntry queue=">" producerFlowControl="false" memoryLimit="8mb"
useCache="false">
                  
                </policyEntry>
              </policyEntries>
            </policyMap>
        </destinationPolicy>

        <persistenceAdapter>
		 <jdbcPersistenceAdapter dataSource="#oracle-ds" />
        </persistenceAdapter>

	<plugins>
 	<loggingBrokerPlugin logAll="true" logConnectionEvents="false"/>
	</plugins>


        
        <managementContext>
            <managementContext createConnector="false"/>
        </managementContext>

      

           <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage limit="64 mb"/>
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="100 gb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="50 gb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

        
<transportConnectors>
            
            <transportConnector name="openwire"
uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600&amp;jms.prefetchPolicy.queuePrefetch=0"/>
            <transportConnector name="amqp"
uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
        </transportConnectors>

        
        <shutdownHooks>
            <bean xmlns="http://www.springframework.org/schema/beans"
class="org.apache.activemq.hooks.SpringContextHook" />
        </shutdownHooks>

    </broker>

    
    <import resource="jetty.xml"/>

</beans>





--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669248.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by Mohit Anchlia <mo...@gmail.com>.
You have consumers and still have pending messages ?

Can you send your config and describe your situation?

Sent from my iPhone

On Jul 13, 2013, at 7:06 AM, pkorwar <pk...@yahoo.com> wrote:

> Is there anybody using ActiveMQ 5.8 and does not have pending messages
> problem?
> If there is, then it is the way ActiveMQ is configured. So, please send me
> the info.
> Otherwise it is a bug.
> 
> Thanks
> Pramod
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669246.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by pkorwar <pk...@yahoo.com>.
Is there anybody using ActiveMQ 5.8 and does not have pending messages
problem?
If there is, then it is the way ActiveMQ is configured. So, please send me
the info.
Otherwise it is a bug.

Thanks
Pramod



--
View this message in context: http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239p4669246.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Messages stuck in pending state in queue

Posted by Christian Posta <ch...@gmail.com>.
Please try your use case out on a later version, at least 5.8.0. Can even
try a snapshot of 5.9



On Friday, July 12, 2013, pkorwar wrote:

> Hi all,
> I have read several of the threads where people experienced messages stuck
> in pending state in queues.
> I see that ActiveMQ from version 5.1 onward has this issue. Has this ever
> been fixed?
>
> I am also experiencing the same now. The incoming message flow rate is very
> minimal. I have registered 5 consumers on persistent queue (Oracle jdbc).
> The messages go into the queue quite randomly. I have not seen any pattern
> as to when the messages are sent to the pending state.
>
> Is there a fix for this? Is there any version after 5.0 where this pending
> messages problem does not exist?
> Please help.
>
>
> Thanks
> Pramod
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Messages-stuck-in-pending-state-in-queue-tp4669239.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>


-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta