You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by denny86 <de...@geojit.com> on 2010/01/07 09:48:13 UTC

Bad allocation error

Hi,

I stumbled upon following error while listening to messages

Listening for messages [Press Ctrl+C to Quit]...2010-jan-07 13:45:13 error
FAIL
[2737 192.168.99.44:5672]: bad allocation (.\qpid\client\Connector.cpp:396)
2010-jan-07 13:45:13 warning Connection closed
Connection closed


 I'm using Qpid C++ Broker and C++ client running on win32 platform.

 I have a subscription manager subscribing to three subjects and with
following settings:

            SubscriptionSettings settings; 
            settings.exclusive=false;
            settings.acceptMode = ACCEPT_MODE_EXPLICIT;
            settings.acquireMode = ACQUIRE_MODE_NOT_ACQUIRED; 
            settings.autoAck=0;

Well i'm not using any local queues. Just working on topic_listener example.
In which i am processing messages at Listener::received() function. There i
wud check for each messages' destination routing key and then process the
message as accordingly. 

After that, i would acknowledges those messages with session.messageAccept.
There lies the problem

ie, On each message arrival, i would do this  
seqNSEMsgAck.add(message.getId());  [Declarations: SequenceSet  seqNSEMsgAck
and Message message ]

 Then when i tried to perform accept, i receive this error after some
successfully retrieval plus accepting prior messages.

	    session.messageAcquire(seqMsgAck);
	    session.messageAccept(seqMsgAck); 
       	    session.sendCompletion();
	    session.sync();

When i get this error, queuestats program [from qmf console example] reports
increase in queue depth. Otherwise it would show max queue depth of 1 only,
after enqueue and dequeue.

Also i tired to accept after listening to 1000 messages. But still same
result. But here i noted that this error will occur after a very long time.

Am I missing out anything?

Please reply...

I am getting used to Qpid. Hope some wud help, thanks :handshake:


-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4265473.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.
i will try it out now. 

thanks
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4289738.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/12/2010 08:53 AM, denny86 wrote:
>
>
> Gordon Sim wrote:
>>
>>
>> So the crash was happening when you were manually accepting. Was autoAck
>> set to 0 or left as the default value?
>>
>>
> Yes crash occur, when calling messageAccept()
> Left autoAck as default value. Or non-zero. doesn't matter

Just to follow up on this, I've done some testing here (on linux) and I 
believe the memory growth in this case is due to message build up in the 
dispatch queue.

The broker sends messages as fast as it can and in the client these are 
read in by an 'io thread' internal to the client library. The dispatch 
thread then takes these messages and pushes them to listeners. However 
as the Subscription::accept() method is synchronous, this will slow the 
dispatch thread down while the io thread keeps reading in messages and 
queueing them for the dispatcher.

The way to deal with this is to set some flow control. E.g. if you are 
acking every N messages, set a window of N*2 (or similar multiple). That 
prevents the clients memory growing without bounds.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

Gordon Sim wrote:
> 
> 
> So the crash was happening when you were manually accepting. Was autoAck 
> set to 0 or left as the default value?
> 
> 
Yes crash occur, when calling messageAccept() 
Left autoAck as default value. Or non-zero. doesn't matter 



> Really? I would have expected that to be the other way round, i.e. for 
> the pre-acquired mode to be slower as there is an extra step and the 
> broker is a little less efficient on that mode.
> 
> However it shouldn't be crashing in that mode. I'll do some 
> investigation...
> 

Oops i meant the other case. 



> Good to hear you've got something working that you are happy with. 
> Thanks for all the feedback!
> 


you are welcome.
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4290414.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/12/2010 07:26 AM, denny86 wrote:
> Gordon Sim wrote:
>>
>> If not can you try the attached test program? It will listen for a
>> configurable number of messages on queues a, b and c (all bound to
>> amq.fanout for convenience). I can consume 10 million messages from each
>> queue without seeing any issue (neither crashes nor memory growth) on
>> linux.
>>
>
> Your program works fine. For ACCEPT_MODE_EXPLICIT and
> ACQUIRE_MODE_PRE_ACQUIRED, you didnt call messageAccept() explicitly. So its
> not required right?

Right. ACCEPT_MODE_EXPLICIT only means that the *broker* expects 
explicit accepts (and thus ensures that transfer is reliable). The 
autoAck setting can be used to tell the client library to send the 
accept automatically during dispatch.

> I confirmed with queue-stats tool, its reporting max
> queue depth of 1 in cases.
> I removed this call from my original program and it works great. So far, no
> crash&  memory is stable.

So the crash was happening when you were manually accepting. Was autoAck 
set to 0 or left as the default value?

> For reliability considerations, does ACCEPT_MODE_EXPLICIT and
> ACQUIRE_MODE_NOT_ACQUIRED score over ACCEPT_MODE_EXPLICIT and
> ACQUIRE_MODE_PRE_ACQUIRED.

No, in each case the transfer is reliable. I would recommend the latter 
option unless there was a clear reason not to.

> In second case, program crashes and also
> processing is slower compared to former.

Really? I would have expected that to be the other way round, i.e. for 
the pre-acquired mode to be slower as there is an extra step and the 
broker is a little less efficient on that mode.

However it shouldn't be crashing in that mode. I'll do some 
investigation...

> Well i guess its kinda of
> Speed-reliability trade-off situation

The not-acquired mode with manual acquire doesn't give you more 
'reliability'.

> thanks for the insight, Gordon.  :clap:

Good to hear you've got something working that you are happy with. 
Thanks for all the feedback!

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.


Gordon Sim wrote:
> 
> If not can you try the attached test program? It will listen for a 
> configurable number of messages on queues a, b and c (all bound to 
> amq.fanout for convenience). I can consume 10 million messages from each 
> queue without seeing any issue (neither crashes nor memory growth) on
> linux.
> 

Your program works fine. For ACCEPT_MODE_EXPLICIT and
ACQUIRE_MODE_PRE_ACQUIRED, you didnt call messageAccept() explicitly. So its
not required right? I confirmed with queue-stats tool, its reporting max
queue depth of 1 in cases. 
I removed this call from my original program and it works great. So far, no
crash & memory is stable.

For reliability considerations, does ACCEPT_MODE_EXPLICIT and
ACQUIRE_MODE_NOT_ACQUIRED score over ACCEPT_MODE_EXPLICIT and
ACQUIRE_MODE_PRE_ACQUIRED. In second case, program crashes and also
processing is slower compared to former. Well i guess its kinda of
Speed-reliability trade-off situation

thanks for the insight, Gordon.  :clap:

Regards,
Dennu
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4290135.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/11/2010 04:20 AM, denny86 wrote:
>
>
> Gordon Sim wrote:
>>
>>
>> The simplest way (in my view) is to pass in an instance of
>> SubscriptionSettings to each SubscriptionManager::subscribe() call.
>>
>> However if the default settings work for you (and it sounds like they
>> might?) then you don't even need to do that. Just call subscribe with
>> your listener and the queue name.
>>
>
> Default setting is working fine.
>
> But problem is that when i set ACCEPT_MODE_EXPLICIT for multiple queues,
> program crashes even if auto acquire is off or on.

The default accept mode is ACCEPT_MODE_EXPLICIT. When you say above that 
the default settings work fine does that mean they work fine even for 
multiple queues?

If so what is the change that causes the multiple queues case not to work?

If not can you try the attached test program? It will listen for a 
configurable number of messages on queues a, b and c (all bound to 
amq.fanout for convenience). I can consume 10 million messages from each 
queue without seeing any issue (neither crashes nor memory growth) on linux.

> Now i am trying with ACCEPT_MODE_EXPLICIT and ACQUIRE_MODE_PRE_ACQUIRED, but
> program crashes after sometime. But one advantage using
> ACQUIRE_MODE_PRE_ACQUIRED is that queue is correctly dequeued after
> accepting the msg, and that queue depth is reported 0 as per queue-stats
> tool. If i would have set ACQUIRE_MODE_NOT_ACQUIRED, queue depth would be
> greater and also program crashes in this case also. Only mode working with
> multiple queues from my experiences, is ACCEPT_MODE_NONE. I would confirm
> this info with more research from my side.
>
> Thanks&  Regards,
> Denny


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

Gordon Sim wrote:
> 
> 
> The simplest way (in my view) is to pass in an instance of 
> SubscriptionSettings to each SubscriptionManager::subscribe() call.
> 
> However if the default settings work for you (and it sounds like they 
> might?) then you don't even need to do that. Just call subscribe with 
> your listener and the queue name.
> 

Default setting is working fine. 

But problem is that when i set ACCEPT_MODE_EXPLICIT for multiple queues,
program crashes even if auto acquire is off or on.
Now i am trying with ACCEPT_MODE_EXPLICIT and ACQUIRE_MODE_PRE_ACQUIRED, but
program crashes after sometime. But one advantage using
ACQUIRE_MODE_PRE_ACQUIRED is that queue is correctly dequeued after
accepting the msg, and that queue depth is reported 0 as per queue-stats
tool. If i would have set ACQUIRE_MODE_NOT_ACQUIRED, queue depth would be
greater and also program crashes in this case also. Only mode working with
multiple queues from my experiences, is ACCEPT_MODE_NONE. I would confirm
this info with more research from my side.

Thanks & Regards,
Denny
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4283761.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.


denny86 wrote:
> 
> I have a similar solution [not tried yet] to my problem.
> 
> http://n2.nabble.com/ATL-Project-td2944757.html
> 
> But that is referring to an ATL project. mine is not ATL. anyways will try
> out what Steve says.
> 
> 

didnt work out....

-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4271477.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.
I have a similar solution [not tried yet] to my problem.

http://n2.nabble.com/ATL-Project-td2944757.html

But that is referring to an ATL project. mine is not ATL. anyways will try
out what Steve says.

hope i'm not spamming here. =^D
Regards,
Denny
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4271180.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/08/2010 12:42 PM, denny86 wrote:
>
>
> Gordon Sim wrote:
>>
>> In your first mail you stated you were using ACQUIRE_MODE_NOT_ACQUIRED.
>> Are you in fact using ACQUIRE_MODE_PRE_ACQUIRED? If so that is what I
>> was suggesting. In that case you do not need to manually acquire at all.
>>
>
> Initially, i set to ACQUIRE_MODE_NOT_ACQUIRED and ACCEPT_MODE_EXPLICIT only.
>
> But if i do ACQUIRE_MODE_PRE_ACQUIRED and ACCEPT_MODE_EXPLICIT combination,
> will i get reliable transfer? ie, for eg, if i lost a message, then will i
> get in the next try, provided publisher and broker is running with no
> issues?

Yes, messages will only be dequeued once accepted (and even if you set 
autoAck to a non-zero value they will never be accepted until your 
listener has processed them). So if the connection or client is killed 
then unaccepted messages will be redelivered on re-subscribing.

> Gordon Sim wrote:
>>
>> The default subscription settings give reliable transfer. When used with
>> a listener auto-ack will only accept messages after the listeners
>> received() method returns so you often will not need to resort to manual
>> accepts either (unless you have some need to e.g. release some messages
>> or if you are using a LocalQueue).
>>
>> Have you tried with the default subscription settings?
>>
>
> No, i left two fields - autoAck and flow control. Only used this
> ACQUIRE_MODE_NOT_ACQUIRED and ACCEPT_MODE_EXPLICIT as subscription
> parameters.

Ok, so if autoAck is non-zero then accepts will be handled for you.

> Also i am confused with sub settings, should i configure subscription
> settings through SubscriptionManager class OR SubscriptionSettings Class? I
> have done the former one

The simplest way (in my view) is to pass in an instance of 
SubscriptionSettings to each SubscriptionManager::subscribe() call.

However if the default settings work for you (and it sounds like they 
might?) then you don't even need to do that. Just call subscribe with 
your listener and the queue name.



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

Gordon Sim wrote:
> 
> In your first mail you stated you were using ACQUIRE_MODE_NOT_ACQUIRED. 
> Are you in fact using ACQUIRE_MODE_PRE_ACQUIRED? If so that is what I 
> was suggesting. In that case you do not need to manually acquire at all.
> 

Initially, i set to ACQUIRE_MODE_NOT_ACQUIRED and ACCEPT_MODE_EXPLICIT only.

But if i do ACQUIRE_MODE_PRE_ACQUIRED and ACCEPT_MODE_EXPLICIT combination,
will i get reliable transfer? ie, for eg, if i lost a message, then will i
get in the next try, provided publisher and broker is running with no
issues?


Gordon Sim wrote:
> 
> The default subscription settings give reliable transfer. When used with 
> a listener auto-ack will only accept messages after the listeners 
> received() method returns so you often will not need to resort to manual 
> accepts either (unless you have some need to e.g. release some messages 
> or if you are using a LocalQueue).
> 
> Have you tried with the default subscription settings?
> 

No, i left two fields - autoAck and flow control. Only used this 
ACQUIRE_MODE_NOT_ACQUIRED and ACCEPT_MODE_EXPLICIT as subscription
parameters.

Also i am confused with sub settings, should i configure subscription
settings through SubscriptionManager class OR SubscriptionSettings Class? I
have done the former one

-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4272154.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/08/2010 12:16 PM, denny86 wrote:
>
>
> Gordon Sim wrote:
>>
>>
>> Maybe worth asking as an aside at this point why it is you want to
>> subscribe in unacquired mode? Do you want to acquire every message you
>> receive? If so the pre-acquired mode will do that more simply and
>> efficiently.
>>
>>
>
> All i need is to confirm each message received by subscriber with the
> broker. i.e, i need a reliable type of communication.
>
> Thats why i turned on ACCEPT_MODE_EXPLICIT.

That is correct, you *do* want ACCEPT_MODE_EXPLICIT for reliable transfer.

> Also, i turn on pre-acquired mode, because i thought otherwise there is no
> point in explicit acceptance. That broker will de-queue the msg
> automatically without getting "accepted" for that.? is that true?

In your first mail you stated you were using ACQUIRE_MODE_NOT_ACQUIRED. 
Are you in fact using ACQUIRE_MODE_PRE_ACQUIRED? If so that is what I 
was suggesting. In that case you do not need to manually acquire at all.

> In fact i turned on once, but i had to remove this, because here also i
> faced same problem.
>
> If i turn acquire off, then broker would dequeue that messages, unless and
> until it receives "accept" msg only, further that msg is acquired by
> subscriber. Thats my understand, please correct me if i am wrong.
>
> Only combination proved me working with no issues and too for multiple queue
> listeners,  is   ACCEPT_MODE_NONE and ACQUIRE_MODE_PRE_ACQUIRED.
 >
> If there is any other way to setup reliable connection between broker and
> subscribers, i would gladly add on to my code.

The default subscription settings give reliable transfer. When used with 
a listener auto-ack will only accept messages after the listeners 
received() method returns so you often will not need to resort to manual 
accepts either (unless you have some need to e.g. release some messages 
or if you are using a LocalQueue).

Have you tried with the default subscription settings?

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

Gordon Sim wrote:
> 
> 
> Maybe worth asking as an aside at this point why it is you want to 
> subscribe in unacquired mode? Do you want to acquire every message you 
> receive? If so the pre-acquired mode will do that more simply and 
> efficiently.
> 
> 

All i need is to confirm each message received by subscriber with the
broker. i.e, i need a reliable type of communication.

Thats why i turned on ACCEPT_MODE_EXPLICIT. 

Also, i turn on pre-acquired mode, because i thought otherwise there is no
point in explicit acceptance. That broker will de-queue the msg
automatically without getting "accepted" for that.? is that true?  
In fact i turned on once, but i had to remove this, because here also i
faced same problem. 

If i turn acquire off, then broker would dequeue that messages, unless and
until it receives "accept" msg only, further that msg is acquired by
subscriber. Thats my understand, please correct me if i am wrong.

Only combination proved me working with no issues and too for multiple queue
listeners,  is   ACCEPT_MODE_NONE and ACQUIRE_MODE_PRE_ACQUIRED.

If there is any other way to setup reliable connection between broker and
subscribers, i would gladly add on to my code. 

Thanks,

Regards,
Denny
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4272038.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/08/2010 06:05 AM, denny86 wrote:
>
> Further research, i found that queue with min queue depth will dequeue the
> message even if i dont acquire and accept those messages in that queue. How
> is that possible? I didnt turn on auto delete.
>
>   To verify that if have not gone wrong somewhere,  I checked the instances
> of subscription class for each queue, and they belong exactly to where they
> should. Also i checked that i have three SequenceSet objects for each queue
> and acquire/accept is done within separated threads being spawn. Threads are
> spawn after receiving 1000 messages for each queue. As doing at every
> retrieval, is causing poor performance.
>
> Also i tired to call getAcquired() of each SequenceSet objects and forcibly
> tried to acquire those messages. But it didnt work out. One thing i need to
> point out here is that regardless of any case getAccepted() always returns
> '0'. why is that so? While queuestats reports some high queue depth.

Do you mean getUnaccepted()? Ids are only moved to that set after you 
have successfully acquired them. They are then removed when you accept 
them. So unless you check that set between the acquire() and accept() 
the size will be 0. If the size of the unaccepted set is 0 after the 
acquire call then none of the messages could be acquired - you can 
confirm that be checking that the unacquired set doesn't change. Failure 
to acquire means that the message has been acquired by some other 
subscriber.

Maybe worth asking as an aside at this point why it is you want to 
subscribe in unacquired mode? Do you want to acquire every message you 
receive? If so the pre-acquired mode will do that more simply and 
efficiently.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.
Further research, i found that queue with min queue depth will dequeue the
message even if i dont acquire and accept those messages in that queue. How
is that possible? I didnt turn on auto delete.

 To verify that if have not gone wrong somewhere,  I checked the instances
of subscription class for each queue, and they belong exactly to where they
should. Also i checked that i have three SequenceSet objects for each queue
and acquire/accept is done within separated threads being spawn. Threads are
spawn after receiving 1000 messages for each queue. As doing at every
retrieval, is causing poor performance.

Also i tired to call getAcquired() of each SequenceSet objects and forcibly
tried to acquire those messages. But it didnt work out. One thing i need to
point out here is that regardless of any case getAccepted() always returns
'0'. why is that so? While queuestats reports some high queue depth.


-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4270789.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.


Gordon Sim wrote:
> 
> On 01/07/2010 01:19 PM, denny86 wrote:
>>
>>
>>
>> Gordon Sim wrote:
>>>
>>>
>>> Each subscription will have its own Subscription instance. You will need
>>> to acquire and accept messages received from each queue through the
>>> relevant Subscription object.
>>>
>>
>> Yes... i am working on that already....
>>
>> Is session.sync(); required after sending Complete?
> 
> No, its not required.
> 
> 

Problem is that with 1 queue it works fine. When more queues are added,  if
there are plenty amount of messages to processes for each, acq/acpt, it
slips by.. I see an increase in those queues, except the first one which
will have a min depth.

Processing those accept/acquire msgs in separate threads, also does not
work!

After processing some messages, client crashes with this error.
Today, i will look into this matter deeply.

-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4270496.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/07/2010 01:19 PM, denny86 wrote:
>
>
>
> Gordon Sim wrote:
>>
>>
>> Each subscription will have its own Subscription instance. You will need
>> to acquire and accept messages received from each queue through the
>> relevant Subscription object.
>>
>
> Yes... i am working on that already....
>
> Is session.sync(); required after sending Complete?

No, its not required.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.


Gordon Sim wrote:
> 
> 
> Each subscription will have its own Subscription instance. You will need 
> to acquire and accept messages received from each queue through the 
> relevant Subscription object.
> 

Yes... i am working on that already.... 

Is session.sync(); required after sending Complete?
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4266395.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/07/2010 12:21 PM, denny86 wrote:
>
>
> denny86 wrote:
>>
>>
>>
>> Yes, got it.. Using session to acquire and accept messages would fail
>> after sometime. But using Subscription Instance, i face no problem.
>>
>> Now enqueue/dequeue operations are working smooth.. No issues so far,
>> 200,000 messages processed without fail. ;)
>>
>> Thank you Gordon :)
>>
>> Regards,
>> Denny
>>
>
> But there is a problem when number of queues increased. It fails miserably.
> Out of three queues,  first queue depth reported is 0, after acquiring and
> accepting. Its ok! But other two would still contain 10%-20% messages within
> queues even after acquiring and accepting. This leads to abormal termination
> of client.

Each subscription will have its own Subscription instance. You will need 
to acquire and accept messages received from each queue through the 
relevant Subscription object.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

denny86 wrote:
> 
> 
> 
> Yes, got it.. Using session to acquire and accept messages would fail
> after sometime. But using Subscription Instance, i face no problem.
> 
> Now enqueue/dequeue operations are working smooth.. No issues so far,
> 200,000 messages processed without fail. ;)
> 
> Thank you Gordon :)
> 
> Regards,
> Denny
> 

But there is a problem when number of queues increased. It fails miserably.
Out of three queues,  first queue depth reported is 0, after acquiring and
accepting. Its ok! But other two would still contain 10%-20% messages within
queues even after acquiring and accepting. This leads to abormal termination
of client.


-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4266152.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.


Gordon Sim wrote:
> 
> 

Yes, got it.. Using session to acquire and accept messages would fail after
sometime. But using Subscription Instance, i face no problem.

Now enqueue/dequeue operations are working smooth.. No issues so far,
200,000 messages processed without fail. ;)

Thank you Gordon :)

Regards,
Denny
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4265980.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.


Gordon Sim wrote:
> 
> 
> They are on the Subscription class, you get one of those returned from 
> SubscriptionManager::subscribe().
> 
> 

Yes i found it.. i misread ur early post.

i looked upon SubscriptionManager and not Subscription class... Going to try
that now..

tnx & regards,
Denny
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4265895.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/07/2010 10:13 AM, denny86 wrote:
>
>
> Gordon Sim wrote:
>>
>> Try changing this to use the acquire() and accept() messages on the
>> Subscription class (you get an instance of this returned when you call
>> subscribe() on SubscriptionManager.
>>
>
>
> Sorry i can't find acquire() and accept() member functions within the
> SubscriptionManager class.

They are on the Subscription class, you get one of those returned from 
SubscriptionManager::subscribe().

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

Gordon Sim wrote:
> 
> Try changing this to use the acquire() and accept() messages on the 
> Subscription class (you get an instance of this returned when you call 
> subscribe() on SubscriptionManager. 
> 


Sorry i can't find acquire() and accept() member functions within the
SubscriptionManager class.
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4265724.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by denny86 <de...@geojit.com>.

Gordon Sim wrote:
> 
> Sounds like your client process is running out of memory(?). This is 
> using the 0.5 code, right?
> 

Yes. I'm using 0.5 version. 
I didnt figure out any memory leaks initially.


Gordon Sim wrote:
> 
> Try changing this to use the acquire() and accept() messages on the 
> Subscription class (you get an instance of this returned when you call 
> subscribe() on SubscriptionManager. The subscription tracks all 
> unaquired and unaccepted messages and if you are directly invoking the 
> methods on the session as above it will not update those sets to reflect 
> successfully acquired and accepted ids. In other words the sets held in 
> the subscription will continue to grow - in your case the unacquired set.
> 

I will try that now... and will come with reply soon. thanks alot :)

Regards,
Denny
-- 
View this message in context: http://n2.nabble.com/Bad-allocation-error-tp4265473p4265699.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Bad allocation error

Posted by Gordon Sim <gs...@redhat.com>.
On 01/07/2010 08:48 AM, denny86 wrote:
>
> Hi,
>
> I stumbled upon following error while listening to messages
>
> Listening for messages [Press Ctrl+C to Quit]...2010-jan-07 13:45:13 error
> FAIL
> [2737 192.168.99.44:5672]: bad allocation (.\qpid\client\Connector.cpp:396)
> 2010-jan-07 13:45:13 warning Connection closed
> Connection closed

Sounds like your client process is running out of memory(?). This is 
using the 0.5 code, right?

>   I'm using Qpid C++ Broker and C++ client running on win32 platform.
>
>   I have a subscription manager subscribing to three subjects and with
> following settings:
>
>              SubscriptionSettings settings;
>              settings.exclusive=false;
>              settings.acceptMode = ACCEPT_MODE_EXPLICIT;
>              settings.acquireMode = ACQUIRE_MODE_NOT_ACQUIRED;
>              settings.autoAck=0;
>
> Well i'm not using any local queues. Just working on topic_listener example.
> In which i am processing messages at Listener::received() function. There i
> wud check for each messages' destination routing key and then process the
> message as accordingly.
>
> After that, i would acknowledges those messages with session.messageAccept.
> There lies the problem
>
> ie, On each message arrival, i would do this
> seqNSEMsgAck.add(message.getId());  [Declarations: SequenceSet  seqNSEMsgAck
> and Message message ]
>
>   Then when i tried to perform accept, i receive this error after some
> successfully retrieval plus accepting prior messages.
>
> 	    session.messageAcquire(seqMsgAck);
> 	    session.messageAccept(seqMsgAck);
>         	    session.sendCompletion();
> 	    session.sync();

Try changing this to use the acquire() and accept() messages on the 
Subscription class (you get an instance of this returned when you call 
subscribe() on SubscriptionManager. The subscription tracks all 
unaquired and unaccepted messages and if you are directly invoking the 
methods on the session as above it will not update those sets to reflect 
successfully acquired and accepted ids. In other words the sets held in 
the subscription will continue to grow - in your case the unacquired set.

This is probably something that we should address in the code somehow, 
e.g. having a flag in subscription settings that indicates the 
subscription should not try to do any tracking.

If that doesn't help perhaps running with valgrind might help determine 
if there are any leaks. Is there anything in your application that might 
be continually growing as messages arrive?

> When i get this error, queuestats program [from qmf console example] reports
> increase in queue depth. Otherwise it would show max queue depth of 1 only,
> after enqueue and dequeue.
>
> Also i tired to accept after listening to 1000 messages. But still same
> result. But here i noted that this error will occur after a very long time.
>
> Am I missing out anything?
>
> Please reply...
>
> I am getting used to Qpid. Hope some wud help, thanks :handshake:
>
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org