You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Fraser Adams <fr...@blueyonder.co.uk> on 2012/02/29 20:07:15 UTC
C++ broker memory leak in federated set-up???
Hi All,
I think that we may have stumbled across a potential memory/resource leak.
We have one particular set up where we have a C++ producer client (using
qpid::client - don't ask, it's a long story.....) this writes to a 0.8
broker hosted on the same server. That broker is then federated via a
queue route to amq.match on another (0.8) broker. The queue route is a
source route set up via qpid-route -s
We've been having all sorts of fun and games with respect to
performance, which we've narrowed down to some dodgy networking.
However one of the other effects that we've noticed is that the broker
co-located with the producer client eats memory. The queue for the queue
route is 1GB but qpidd eventually grows to ~35GB and sends the whole set
up into swap.
So with respect to the network problem we're suspecting a dodgy switch
somewhere, what is interesting is that when we checked with ethtool the
NIC was reporting half duplex had been negotiated - ouch!!! hence why we
suspect a dodgy switch somewhere.
Now when the NIC was explicitly set to 100 base/T full duplex our
performance rocketed and the broker on the producer system appears
(touch wood) to have stable memory performance.
What I'm suspecting is that the dodgy network link has been causing
connection drop-outs and the broker is automatically reconnecting (logs
are confirming this) and I'm thinking that there is a resource leak
somewhere during the reconnection process.
Is this behaviour that anyone else has experienced. I realise 0.8 is
pretty old but a lot of our end to end system isn't under my control, if
there is a known resource leak that has been fixed in a later version it
might give me some ammunition to "suggest" upgrading to a more
up-to-date version. I'd love to know if anyone else has seen this.
MTIA,
Frase
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 06:51 PM, Fraser Adams wrote:
>
>>
>> subscription = subscriptions.subscribe(*this, queue,
>> SubscriptionSettings(FlowControl::messageWindow(100),
>> ACCEPT_MODE_NONE));
> Unfortunately that setting just seemed to cause my consumer to hang
> after getting the first 100 messages.
>
> subscription = subscriptions.subscribe(*this, queue,
> SubscriptionSettings(FlowControl::messageWindow(100)));
>
> seemed to work OK without growing memory. I've no idea why adding
> ACCEPT_MODE_NONE should cause it to misbehave, it should have simply
> removed the need to acknowledge should it not...
Sorry... one more complication with that combination... you will need to
periodically call Session::sendCompletion(), certainly not less then
every 100 messages. This is because if accepts are not required the
auto-ack functionality is disabled and that is where the
sendCompletion() is done autonatically. (Again, this is what you are
avoiding by using the messaging API everyone! :-)
However, from the perspective of delivery records, if you set
ACCEPT_MODE_NONE, you can leave the flow control as unlimited and you
should still not build up any server side memory.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
>
> subscription = subscriptions.subscribe(*this, queue,
> SubscriptionSettings(FlowControl::messageWindow(100),
> ACCEPT_MODE_NONE));
Unfortunately that setting just seemed to cause my consumer to hang
after getting the first 100 messages.
subscription = subscriptions.subscribe(*this, queue,
SubscriptionSettings(FlowControl::messageWindow(100)));
seemed to work OK without growing memory. I've no idea why adding
ACCEPT_MODE_NONE should cause it to misbehave, it should have simply
removed the need to acknowledge should it not...
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/04/2012 11:03 AM, Fraser Adams wrote:
> The federation links that we are using are source/push routes e.g. set
> up using qpid-route -s
>
> I wonder if that would have any bearing, so the scenario is really a
> bursty producer much like the client-producer example, writing to
> amq.match on a broker co-located on the same host, which has a queue
> route federated to another broker on a different host, which has a
> potentially slow consumer with possibly/probably too much prefetch
> allocated.
>
> So using source routes is it likely then that an end consumer requesting
> too much capacity could cause a problem for the first broker???
Any subscriber requesting a large amount of prefetch could potentially
cause memory growth in the broker they have subscribed to, particularly
if they are slow to process such prefetched messages.
The slowness of a consumer on a queue on the downstream (i.e.
destination) broker to which messages from the upstream (i.e. source)
broker are routed doesn't directly affect the subscription on the
upstream broker.
If it is a slow consumer problem, then it would imply that it is the
handling of messages from the source broker (i.e. routing them through
the amq.match exchange), that is the problem. Comparing the stats from
the source queue and the target exchange might show something if that
were the case (i.e. many more messages delivered from the queue than
routed through the exchange; that of course may require compensating for
the point you start at)
> It (sort
> of) seems odd because if the federation uses unreliable messaging then
> surely that should protect the source broker from the excess capacity -
> but it's very definitely the source broker associated with the producer
> and not the destination broker where be see the issue.
>
>
> Hmmm I wonder Gordon. You've previously said that "federation
> subscriptions do use infinite credit" , so with a source route the
> bridge would behave essentially like a consumer of the queue actually
> deployed on the source broker,
Depends on what you mean; the route appears to the broker as a
subscription from the queue. The push route mainly affects the manner in
which the subscription is issued (it is 'forged' by the broker who sends
the request to itself as if it were the remote peer sending it).
> so if there were any problems at all in
> its communications to the destination broker then it would behave
> exactly like my slow consumer scenario would it not and its memory would
> grow due to the infinite credit? Now the fact that it's unreliable
> messaging might help, but is it correctly implemented for source routes?
The selection of the accept mode is the same code in both types of
routes, so on the face of it at least I can't see why there would be any
difference there.
> You've said before that source routes are the path less travelled, so
> that feels plausible (especially given my experiences with qpid::client
> :-))?
>
> What do you think - do you have any evidence your side or am I just
> clutching at straws??
I can't see any evidence that source routes would cause the behaviour
you are seeing.
If you can reproduce easily, I would suggest (a) once you start seeing
the excessive growth, kill and then re-establish the route and see
whether that resets the growth, (b) compile a later broker in a working
directory somewhere (no need to install) and see if that shows the same
thing.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
>> If I can get evidence to suggest that the federation "unreliable links"
>> behaviour isn't as effective at mitigating this in 0.8 as it is in later
>> brokers that would be useful, as I say I keep arguing that we should be
>> upgrading to something newer.
>
> I've had a scan through the svn logs and I don't see anything
> obviously broken in 0.8; the lines that allow the message to be
> released are in there. However a lot has changed since and many other
> things could interact.
One more possibly relevant detail in this sorry tale of woe.....
The federation links that we are using are source/push routes e.g. set
up using qpid-route -s
I wonder if that would have any bearing, so the scenario is really a
bursty producer much like the client-producer example, writing to
amq.match on a broker co-located on the same host, which has a queue
route federated to another broker on a different host, which has a
potentially slow consumer with possibly/probably too much prefetch
allocated.
So using source routes is it likely then that an end consumer requesting
too much capacity could cause a problem for the first broker??? It (sort
of) seems odd because if the federation uses unreliable messaging then
surely that should protect the source broker from the excess capacity -
but it's very definitely the source broker associated with the producer
and not the destination broker where be see the issue.
Hmmm I wonder Gordon. You've previously said that "federation
subscriptions do use infinite credit" , so with a source route the
bridge would behave essentially like a consumer of the queue actually
deployed on the source broker, so if there were any problems at all in
its communications to the destination broker then it would behave
exactly like my slow consumer scenario would it not and its memory would
grow due to the infinite credit? Now the fact that it's unreliable
messaging might help, but is it correctly implemented for source routes?
You've said before that source routes are the path less travelled, so
that feels plausible (especially given my experiences with qpid::client
:-))?
What do you think - do you have any evidence your side or am I just
clutching at straws??
Frase
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 03:05 PM, Fraser Adams wrote:
> BTW do you know of a good way to allow multiple broker versions to
> co-exist on the same box (short of virtualisation). I always seem to
> need to completely uninstall one version before I can install another
> due to library dependencies. I guess that I could set up a chroot jail,
> but I was wondering if there's a simpler approach?
If you are building yourself, that shouldn't be an issue. You can either
use a prefix when running configure or simply run from the build
directory directly.
If you are using pre-built packages it will likely be a lot trickier.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
On 03/08/12 14:38, Gordon Sim wrote:
> On 08/03/2012 01:35 PM, Fraser Adams wrote:
>> So if the "unreliable message" behaviour isn't behaving as expected in
>> earlier brokers (say 0.8) and we have a slow consumer hanging off the
>> other side of a federated link, then are you suggesting that this just
>> might be the cause of our woes?
>
> I'm not exactly sure where the problem is. Is it the 'upstream' broker
> that is growing? i.e. the one the publisher is connected to? Or is it
> the broker 'downstream' of the federation link (the one the consumer
> is connected to)?
It's the broker that the publisher is connected to that is growing. As I
mentioned previously the really weird thing is that it only seems to
happen when that broker is co-located with the publisher. What's
especially weird is that things are mostly OK. most of our topology
still has the producer and first broker co-located, but we had a
particularly high rate (and quite bursty) producer that was giving us
problems and the work around was to point it to a remote broker. I
suspect that we're seeing it again because many of our other producers
are starting to increase their rate now.
Our theory has been that perhaps the network was doing just enough to
flatten out the burstiness. The test clients are set up to deliver
bursts then sleep as this is quite close to what our real producers do.
>
>> At this stage having a
>> good analysis and understanding is probably most important - so if you
>> can help me enable flow control (and suggest how I'd try unreliable
>> messaging using qpid::client too if possible) in the client-consumer I
>> posted that would be really helpful.
>
> subscription = subscriptions.subscribe(*this, queue,
> SubscriptionSettings(FlowControl::messageWindow(100),
> ACCEPT_MODE_NONE));
>
> Would give a flow controlled, unreliable subscription. However simply
> setting the ACCEPT_MODE_NONE with FlowControl::unlimited() in the
> qpid::client API should prevent build up of messages through delivery
> records at all.
Thanks, I'll try that out.
>
>> If I can get evidence to suggest that the federation "unreliable links"
>> behaviour isn't as effective at mitigating this in 0.8 as it is in later
>> brokers that would be useful, as I say I keep arguing that we should be
>> upgrading to something newer.
>
> I've had a scan through the svn logs and I don't see anything
> obviously broken in 0.8; the lines that allow the message to be
> released are in there. However a lot has changed since and many other
> things could interact.
It's a pity that there's nothing obvious. I'll try your suggestion for
unreliable messaging then I might set my box back to 0.8 to see if it
behaves any differently than 0.12.
BTW do you know of a good way to allow multiple broker versions to
co-exist on the same box (short of virtualisation). I always seem to
need to completely uninstall one version before I can install another
due to library dependencies. I guess that I could set up a chroot jail,
but I was wondering if there's a simpler approach?
Frase.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 01:35 PM, Fraser Adams wrote:
> So if the "unreliable message" behaviour isn't behaving as expected in
> earlier brokers (say 0.8) and we have a slow consumer hanging off the
> other side of a federated link, then are you suggesting that this just
> might be the cause of our woes?
I'm not exactly sure where the problem is. Is it the 'upstream' broker
that is growing? i.e. the one the publisher is connected to? Or is it
the broker 'downstream' of the federation link (the one the consumer is
connected to)?
> At this stage having a
> good analysis and understanding is probably most important - so if you
> can help me enable flow control (and suggest how I'd try unreliable
> messaging using qpid::client too if possible) in the client-consumer I
> posted that would be really helpful.
subscription = subscriptions.subscribe(*this, queue,
SubscriptionSettings(FlowControl::messageWindow(100),
ACCEPT_MODE_NONE));
Would give a flow controlled, unreliable subscription. However simply
setting the ACCEPT_MODE_NONE with FlowControl::unlimited() in the
qpid::client API should prevent build up of messages through delivery
records at all.
> If I can get evidence to suggest that the federation "unreliable links"
> behaviour isn't as effective at mitigating this in 0.8 as it is in later
> brokers that would be useful, as I say I keep arguing that we should be
> upgrading to something newer.
I've had a scan through the svn logs and I don't see anything obviously
broken in 0.8; the lines that allow the message to be released are in
there. However a lot has changed since and many other things could interact.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 02:29 PM, Fraser Adams wrote:
> Any idea why calling setFlowControl() on the subscription didn't work?
Your initial subscription sets infinite credit. The subsequent call to
setFlowControl() adds credit. What is required is first to cancel the
existing infinite credit (through a messageStop()).
> It seems confusing to have a method call that doesn't appear to work...
I would agree its not intuitive. I suspect exposing that method was not
considered carefully enough.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
On 03/08/12 13:56, Gordon Sim wrote:
> On 08/03/2012 01:55 PM, Gordon Sim wrote:
>> On 08/03/2012 01:35 PM, Fraser Adams wrote:
>>> subscription = subscriptions.subscribe(*this, queue);
>>>
>>> subscription.setFlowControl(FlowControl::messageWindow(100)); // Why
>>> doesn't this work :-( ???
>>> subscription.setAutoAck(10);
>>
>> When you say it didn't work, what exactly do you mean? That it behaved
>> like the messaqeCredit() call? or that it didn't restrict the window?
>>
>> Try setting the option on subscribe, rather than after it. E.g.
>>
>> subscription = subscriptions.subscribe(*this, queue,
>> SubscriptionSettings(FlowControl::messageCredit(100)));
>
> Sorry! That should read messageWindow() of course!!
>
So yeah when I tried
subscription.setFlowControl(FlowControl::messageWindow(100));
It behaved as if I hadn't done anything and my memory consumption grew
out of control.
I've now tried
subscription = subscriptions.subscribe(*this, queue,
SubscriptionSettings(FlowControl::messageWindow(100)));
subscription.setAutoAck(10);
As you suggested here and both qpidd and client-consumer seem happier -
qpidd is on ~320M and client-consumer is on ~220M SHR according to top
and are both fairly stable.
Any idea why calling setFlowControl() on the subscription didn't work?
It seems confusing to have a method call that doesn't appear to work...
On my other questions - so now I've got flow control working can you
suggest how to configure a qpid::client consumer to use unreliable
messaging?
So if I can configure client-consumer with unlimited flow control and
unreliable messaging will that be a fair emulation of a broker bridge
with a slow consumer hanging off it. I might then be able to try it with
my 0.12 broker then a 0.8 broker and see if they behave differently - if
they do then that just *might* be our smoking gun - what do you think
(unless you already know the answer).
Cheers,
Frase
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 01:55 PM, Gordon Sim wrote:
> On 08/03/2012 01:35 PM, Fraser Adams wrote:
>> subscription = subscriptions.subscribe(*this, queue);
>>
>> subscription.setFlowControl(FlowControl::messageWindow(100)); // Why
>> doesn't this work :-( ???
>> subscription.setAutoAck(10);
>
> When you say it didn't work, what exactly do you mean? That it behaved
> like the messaqeCredit() call? or that it didn't restrict the window?
>
> Try setting the option on subscribe, rather than after it. E.g.
>
> subscription = subscriptions.subscribe(*this, queue,
> SubscriptionSettings(FlowControl::messageCredit(100)));
Sorry! That should read messageWindow() of course!!
> (or else try a Session::messageStop() passing in the subscription name
> before changing the flow control settings).
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 01:35 PM, Fraser Adams wrote:
> subscription = subscriptions.subscribe(*this, queue);
>
> subscription.setFlowControl(FlowControl::messageWindow(100)); // Why
> doesn't this work :-( ???
> subscription.setAutoAck(10);
When you say it didn't work, what exactly do you mean? That it behaved
like the messaqeCredit() call? or that it didn't restrict the window?
Try setting the option on subscribe, rather than after it. E.g.
subscription = subscriptions.subscribe(*this, queue,
SubscriptionSettings(FlowControl::messageCredit(100)));
(or else try a Session::messageStop() passing in the subscription name
before changing the flow control settings).
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
Thanks for the quick response Gordon!
>
> For a reliable receiver, the broker needs to keep track of all
> unacknowledged messages. That will include all prefetched messages
> (depending on the frequency at which acknowledgements are actually
> sent it may include fetched messages also of course).
We were beginning to wonder if that was what was happening. I guess
that's borne out by my experiments with the messaging-consumer capacity.
>
> If the receiver is unreliable (no explicit acknowledgement expected)
> then (at least in recent brokers) the record will no longer reference
> the message, but simply keep track of the amount of byte credit it
> consumed in order to move the window correctly.
when you say recent - what version? I've been testing at home with 0.12
and when I added the link unreliable stuff to my qpid::messaging client
the consumption seems stable, so I'm guessing 0.12 is OK. Unfortunately
at work the brokers are still 0.8 - I'm pushing to uplift, maybe this
will help my corner....
>
> Yes, you would need to use FlowControl::messageWindow() instead; the
> window will be moved automatically by the library unless you choose to
> handle completions manually. By default qpid::client subscriptions use
> unlimited credit (meaning the prefetch is unbounded).
Hmmm I tried swapping messageCredit() to messageWindow() to no avail -
see below
void Listener::prepareQueue(string queue, string exchange)
{
queue += session.getId().getName();
cout << "Declaring queue: " << queue << endl;
FieldTable q_fields;
q_fields.setString("qpid.policy_type", "ring");
q_fields.setUInt64("qpid.max_size", 100000000/*1000000000*/);
session.queueDeclare(arg::queue = queue, arg::exclusive = true,
arg::autoDelete = true, arg::arguments = q_fields);
FieldTable b_flds;
b_flds.setString("x-match", "all");
b_flds.setString("data-format", "test");
session.exchangeBind(arg::exchange = exchange, arg::queue = queue,
arg::arguments = b_flds);
cout << "Subscribing to queue " << queue << endl;
subscription = subscriptions.subscribe(*this, queue);
subscription.setFlowControl(FlowControl::messageWindow(100)); // Why
doesn't this work :-( ???
subscription.setAutoAck(10);
}
I'm really struggling with qpid::client flow control - I tried looking
through
https://svn.apache.org/repos/asf/qpid/trunk/qpid/cpp/src/tests/qpid-topic-listener.cpp
which I found Googling qpid::client flow control, but as I say when I
did the
SubscriptionSettings settings;
settings.autoAck = 10;
settings.flowControl = FlowControl::messageCredit(100);
listener.subscription = mgr.subscribe(listener, control, settings);
It just hung at 100 messages - clearly qpid::client doesn't like me! the
feeling is mutual :-)
>
> (Yes, I agree its not the easiest API to use and has a fair amount of
> incidental complexity, hence qpid::messaging!)
Your telling me :-)
>
> Indeed, if you are not using the --ack option then there are no
> acknowledgements required. Though the federation subscriptions do use
> infinite credit, this should at least prevent holding on to messages.
> What version of the broker are you using now? (I recall at one time
> there was an older broker in part of the system?)
So we're definitely not using the --ack option, but the " federation
subscriptions do use infinite credit" is troubling. As I say we're using
0.8 brokers.
So if the "unreliable message" behaviour isn't behaving as expected in
earlier brokers (say 0.8) and we have a slow consumer hanging off the
other side of a federated link, then are you suggesting that this just
might be the cause of our woes?
>
> I could probably get you a simple patch if applying that and
> rebuilding is an option.
>
It might be an option - thanks for the offer! At this stage having a
good analysis and understanding is probably most important - so if you
can help me enable flow control (and suggest how I'd try unreliable
messaging using qpid::client too if possible) in the client-consumer I
posted that would be really helpful.
If I can get evidence to suggest that the federation "unreliable links"
behaviour isn't as effective at mitigating this in 0.8 as it is in later
brokers that would be useful, as I say I keep arguing that we should be
upgrading to something newer.
Many thanks again for your help.
Frase
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: more memory "leak" woes.
Posted by Gordon Sim <gs...@redhat.com>.
On 08/03/2012 11:42 AM, Fraser Adams wrote:
> Hello all,
> I've previously posted with a problem whereby in a federated set up
> we've been seeing brokers eat memory. In that case what was weird was
> that when the producer client was pointed to a broker on the same box
> we'd start to see problems, but when it was pointed to a broker on a
> remote box it largely seemed to be stable. It drove us nuts, but we were
> able to park it for a while. We've recently started seeing it again
> where we really had to use a co-located broker.
>
> One thing that seems interesting is that it happens most when the
> consumer was in some way behaving slower than it should.
>
> We're publishing messages to amq.match and the queue the consumers
> receive from is a RING queue, so as far as I can see (intuitively at
> least!!) it shouldn't really matter if the consumer is slow - the
> circular queue should just overwrite the oldest messages.
>
> One of my colleagues wrote a couple of little programs using the
> qpid::client API to reproduce a bursty producer and a slow consumer and
> this seems to reproduce the problem - basically despite a circular queue
> both qpidd and client-consumer memory consumption grows and I start
> swapping madly on my 4G box despite the queue only being 100MB.
>
> I'm more familiar with qpid::messaging, so I tried to reproduce the
> problem using that, what's interesting is that my first attempt couldn't
> reproduce it - but of course the APIs behave differently. Then I started
> wondering about flow control/capacity.
>
> I usually do setCapacity(500) - for no other reason than I think that's
> what the default is for the JMS API. Now with that I was using more
> qpidd memory than I'd expect with a 100M circular queue, but I then
> reduced it to 100 then 10 and realised that the capacity (which I
> thought related to prefetch on the client) was affecting both client and
> qpidd memory consumption. I also noticed that doing "link: {reliability:
> unreliable}" helped.
For a reliable receiver, the broker needs to keep track of all
unacknowledged messages. That will include all prefetched messages
(depending on the frequency at which acknowledgements are actually sent
it may include fetched messages also of course).
In the current broker these records will include a reference to the
message which prevents it being deleted, even if in the case of a ring
queue it is overwritten.
If the receiver is unreliable (no explicit acknowledgement expected)
then (at least in recent brokers) the record will no longer reference
the message, but simply keep track of the amount of byte credit it
consumed in order to move the window correctly.
> I tried enabling flow control in the client-consumer to no avail (I
> struggle to understand that API!!) - I thought adding
>
> SubscriptionSettings settings;
> settings.autoAck = 100;
> settings.flowControl = FlowControl::messageCredit(200);
>
> subscription = subscriptions.subscribe(*this, queue, settings);
>
> to my prepareQueue() method would be the way to do it, but that just
> seemed to cause my consumer to hang after it had received 200 messages.
Yes, you would need to use FlowControl::messageWindow() instead; the
window will be moved automatically by the library unless you choose to
handle completions manually. By default qpid::client subscriptions use
unlimited credit (meaning the prefetch is unbounded).
(Yes, I agree its not the easiest API to use and has a fair amount of
incidental complexity, hence qpid::messaging!)
> So my messaging-consumer can be made to behave in a way that at least
> makes some sense, but what concerns me is back to the problem of
> federated links - as I say we're seeing terrible resource leaks and I
> assume that the federation bridge code is closer to what qpid::client is
> doing, so I've no idea if we can configure a federated link to "honour"
> the behaviour that we'd expect from a circular queue (we use the default
> behaviour which *should* we using unreliable messaging).
Indeed, if you are not using the --ack option then there are no
acknowledgements required. Though the federation subscriptions do use
infinite credit, this should at least prevent holding on to messages.
What version of the broker are you using now? (I recall at one time
there was an older broker in part of the system?)
> hope this makes sense. I've attached the producer and two consumers that
> I've been using to try this stuff out.
>
> I'd appreciate any thoughts and especially any mitigations, this is
> starting to cause us real problems.
I could probably get you a simple patch if applying that and rebuilding
is an option.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
more memory "leak" woes.
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
Hello all,
I've previously posted with a problem whereby in a federated set up
we've been seeing brokers eat memory. In that case what was weird was
that when the producer client was pointed to a broker on the same box
we'd start to see problems, but when it was pointed to a broker on a
remote box it largely seemed to be stable. It drove us nuts, but we were
able to park it for a while. We've recently started seeing it again
where we really had to use a co-located broker.
One thing that seems interesting is that it happens most when the
consumer was in some way behaving slower than it should.
We're publishing messages to amq.match and the queue the consumers
receive from is a RING queue, so as far as I can see (intuitively at
least!!) it shouldn't really matter if the consumer is slow - the
circular queue should just overwrite the oldest messages.
One of my colleagues wrote a couple of little programs using the
qpid::client API to reproduce a bursty producer and a slow consumer and
this seems to reproduce the problem - basically despite a circular queue
both qpidd and client-consumer memory consumption grows and I start
swapping madly on my 4G box despite the queue only being 100MB.
I'm more familiar with qpid::messaging, so I tried to reproduce the
problem using that, what's interesting is that my first attempt couldn't
reproduce it - but of course the APIs behave differently. Then I started
wondering about flow control/capacity.
I usually do setCapacity(500) - for no other reason than I think that's
what the default is for the JMS API. Now with that I was using more
qpidd memory than I'd expect with a 100M circular queue, but I then
reduced it to 100 then 10 and realised that the capacity (which I
thought related to prefetch on the client) was affecting both client and
qpidd memory consumption. I also noticed that doing "link: {reliability:
unreliable}" helped.
I tried enabling flow control in the client-consumer to no avail (I
struggle to understand that API!!) - I thought adding
SubscriptionSettings settings;
settings.autoAck = 100;
settings.flowControl = FlowControl::messageCredit(200);
subscription = subscriptions.subscribe(*this, queue, settings);
to my prepareQueue() method would be the way to do it, but that just
seemed to cause my consumer to hang after it had received 200 messages.
So my messaging-consumer can be made to behave in a way that at least
makes some sense, but what concerns me is back to the problem of
federated links - as I say we're seeing terrible resource leaks and I
assume that the federation bridge code is closer to what qpid::client is
doing, so I've no idea if we can configure a federated link to "honour"
the behaviour that we'd expect from a circular queue (we use the default
behaviour which *should* we using unreliable messaging).
hope this makes sense. I've attached the producer and two consumers that
I've been using to try this stuff out.
I'd appreciate any thoughts and especially any mitigations, this is
starting to cause us real problems.
MTIA
Fraser.
-------- Original Message --------
Subject: Re: C++ broker memory leak in federated set-up???
Date: Thu, 01 Mar 2012 15:04:04 +0000
From: Gordon Sim <gs...@redhat.com>
Reply-To: users@qpid.apache.org
Organisation: Red Hat UK Ltd, Registered in England and Wales under
Company Registration No. 3798903, Directors: Michael Cunningham (USA),
Mark Hegarty (Ireland), Matt Parsons (USA), Charlie Peters (USA)
To: users@qpid.apache.org
On 02/29/2012 07:07 PM, Fraser Adams wrote:
> Hi All,
> I think that we may have stumbled across a potential memory/resource leak.
>
> We have one particular set up where we have a C++ producer client (using
> qpid::client - don't ask, it's a long story.....) this writes to a 0.8
> broker hosted on the same server. That broker is then federated via a
> queue route to amq.match on another (0.8) broker. The queue route is a
> source route set up via qpid-route -s
>
> We've been having all sorts of fun and games with respect to
> performance, which we've narrowed down to some dodgy networking.
>
> However one of the other effects that we've noticed is that the broker
> co-located with the producer client eats memory. The queue for the queue
> route is 1GB but qpidd eventually grows to ~35GB and sends the whole set
> up into swap.
>
> So with respect to the network problem we're suspecting a dodgy switch
> somewhere, what is interesting is that when we checked with ethtool the
> NIC was reporting half duplex had been negotiated - ouch!!! hence why we
> suspect a dodgy switch somewhere.
>
> Now when the NIC was explicitly set to 100 base/T full duplex our
> performance rocketed and the broker on the producer system appears
> (touch wood) to have stable memory performance.
>
> What I'm suspecting is that the dodgy network link has been causing
> connection drop-outs and the broker is automatically reconnecting (logs
> are confirming this) and I'm thinking that there is a resource leak
> somewhere during the reconnection process.
https://issues.apache.org/jira/browse/QPID-3447 perhaps? Though I
wouldn't have expected that to cause such a large growth in memory.
Your sure there is no backed up queue anywhere?
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Gordon Sim <gs...@redhat.com>.
On 03/15/2012 05:27 PM, Fraser Adams wrote:
> I *assume* that there are no sneaky little optimisations going on under
> the hood when client and broker are located on the same host, like
> "let's do some memory mapping and bypass the TCP/IP stack"
No, there is no special code for co-location at present.
> I guess under
> the hood this *really does* use an unreliable link and not just some
> reasonable number for N when acknowledging?
Yes, it uses implicit accept mode in AMQP 0-10 terms, meaning the
messages is assumed accepted as soon as its delivered with no need to
wait for an explicit accept from the client.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
> Just btw, you can mark the queue as durable without making the message
> persistent, in which case there would be no performance penalty.
Thanks, yeah I realise that, but you have to explicitly mark the
messages as not persistent, certainly for JMS the spec says that should
be the default and I *thought* it was the default for C++ clients too.
it's something I'm going to look into but the producers aren't directly
under my control so I didn't want to have a dependency at that stage in
the project, it's less of an issue now as the folks in charge of that
aspect are pretty onside. However TBH I *really* wish the queue
configuration persistence aspects and the message persistence aspects
were separately configurable.
Just to make you laugh we also just got bitten with another comedy
moment, we hadn't realised there was a bug in the 0.8 python messaging
API implementation that transparently makes queues durable by default...
We set up a logging client on another part of our system with a circular
queue of decent size and last weekend our operational system got
totalled. What happened was the consumer client died and because the
queue was persistent (unbeknown to us) it had the default journal stuff,
so hit the threshold exceed on the journal size rather than on the queue
byte size - that blew all our federated links.
Monday wasn't a good day :-( if I didn't laugh I'd cry.....fortunately
that was why queue routes were a good choice and most of the data had
backed up on the queues the other side of the link.
>
>> So it's not all that complicated, but it's driving me nuts that when the
>> source broker is co-located with the producer we have a memory increase,
>> but when we host the source broker on a different box it seems to be
>> fine.
>
> That is very weird and my top suspicion would be that there were
> different versions of qpid on the two boxes. Can you run colocated on
> the 'other' box to rule that in our out? Or have you verified that
> they are using the same version of qpid?
Well interestingly that was originally the case, the producer and source
broker were running 0.6 and the destination broker 0.8 I managed to
persuade the folks in charge of the producer system to do a build with 0.8.
One of the things I need to try is to stand up two instances of the
producer and see if I get a problem if each writes to the others' broker.
As it happens when they moved to 0.8 the throughput improved a lot even
before we fixed the network madness that forced the producer NIC into
acting as 10 base/T half duplex :-( However with 0.8 brokers all round
and a sane network we get great message throughput but we still see the
memory growing but it's a lot less pronounced than before, but as I say
if we point the producer to a broker on a different host it seems to be
stable.
I *assume* that there are no sneaky little optimisations going on under
the hood when client and broker are located on the same host, like
"let's do some memory mapping and bypass the TCP/IP stack" :-) I'm
guessing not but stranger things have happened.....
>
> Its a RHEL6 only issue relating to memory allocators in glibc. If both
> boxes are 5.4 we can rule that out.
That's useful to know, though to be honest it's a pity at least it might
preserve my sanity. So presumably this really is only RHEL6? what
version of glibc are we talking about, is it one that doesn't actually
run on 5.4. The reason I ask is that the producer is a high performance
near real time system so they *just may* have got some up to date
versions of things installed. They probably don't use it for any whizzy
allocation as they use their own memory pooling mechanism to improve
multithreaded performance.
That has me thinking I'll check with them that they don't do any fancy
LD_PRELOAD stuff to override the underlying allocator in a way that may
affect other processes. I'm fairly sure they don't but it's worth checking.
> To be honest I'm stumped, I'm afraid and can only offer some
> suggestions on what I might do to search for any further clues...
>
> Just to confirm, you have run qpid-stat -c, qpid-stat -q and qpid-stat
> -u against a bloating broker? And everything shown there is as
> expected (not much queue depth, message counts correlating, no
> unexpected activity)?
It all *looks* as I'd expect. Clearly when we had network problems the
queue on the route was filling up and eventually circled round but now
the depth floats around one or two items.
>
> When the memory growth starts happening, if you delete and recreate
> the bridge does that have any effect on growth?
That's not something we've tried it's worth looking into, of course
Murphy's law has generally kicked in and made the problem most often
happen at night :-/ I'm wondering if it's bad karma and I did something
awful in a past life :->
>
> Is it reproducible at all with more detailed logging (ideally
> --log-enable info+ --log-enable trace+:amqp_0_10)? Obviously logs like
> that grow pretty quickly so depending on the scale of the leak that
> may not be feasible. It might give some clues though (then again it
> might not :-(). Perhaps even a short run from both co-located and
> remote cases to see if a comparison shows anything up?
>
It's worth a try.
I'm still suspicious of acks as it's the only thing that I've ever seen
cause qpidd to bloat in an obvious way, but as I say we're using default
route config. so these should be unreliable. I guess under the hood this
*really does* use an unreliable link and not just some reasonable number
for N when acknowledging?
Thanks for for the pointers, even though I'm not much closer to a
solution it's nice to have people adding their thoughts it's going to be
something really obtuse in the end. I appreciate the moral support!!
Cheers,
Frase
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Gordon Sim <gs...@redhat.com>.
On 03/14/2012 06:45 PM, Fraser Adams wrote:
> As far as I'm aware we're not using acknowledgements, what I mean is
> that I believe that the default with qpid-route is for no acks, I think
> it sends messages via an unreliable link. I thought that you explicitly
> had to enable acks with the --ack= option in qpid-route? have I missed
> something?
No, that is correct, just checking.
[...]
> The route is a source route because we don't want the performance
> penalty of persistence and can tolerate some message loss and by using
> source routes if the producer fails and restarts we don't get into the
> pain whereby "normal" routes would try to reconnect the link then
> silently fail because the queue isn't yet in place, so with source
> routes we have a script that when the broker starts it re-creates the
> queue and the binding then re-establishes the route in the correct order.
Just btw, you can mark the queue as durable without making the message
persistent, in which case there would be no performance penalty.
> So it's not all that complicated, but it's driving me nuts that when the
> source broker is co-located with the producer we have a memory increase,
> but when we host the source broker on a different box it seems to be fine.
That is very weird and my top suspicion would be that there were
different versions of qpid on the two boxes. Can you run colocated on
the 'other' box to rule that in our out? Or have you verified that they
are using the same version of qpid?
> As I said in previous posts it seems to be exacerbated when the network
> is dodgy so I too initially suspected an acknowledgement issue, but as I
> say as far as I'm aware federation links are unreliable and don't
> require acknowledgement "by default".
[...]
> BTW to answer one of Gordon's previous questions we're running RHEL5.4
> however your comment "where a the per-thread pools of memory didn't work
> well in the case of a thread that always worked on producing (hence
> allocating) and another that did all the consuming (hence freeing).". I
> *guess* we must have a similar situation to that with a single queue on
> the source broker and our producer delivering data to amq.match on that
> and the federation link consuming, but it is RHEL5.4 not RHEL6 I've no
> idea how we'd identify if this scenario is affecting us too - is there a
> way to work out if that issue is actually kicking in?
Its a RHEL6 only issue relating to memory allocators in glibc. If both
boxes are 5.4 we can rule that out.
> Also I'm thinking it's not a Boost issue (which is one of the other
> straws I was clutching) we've checked the server qpid was built on and
> the boxes giving pain and they are running the same Boost version (1.33
> something I think).
>
> I'd appreciate any more thoughts you guys may have.
To be honest I'm stumped, I'm afraid and can only offer some suggestions
on what I might do to search for any further clues...
Just to confirm, you have run qpid-stat -c, qpid-stat -q and qpid-stat
-u against a bloating broker? And everything shown there is as expected
(not much queue depth, message counts correlating, no unexpected activity)?
When the memory growth starts happening, if you delete and recreate the
bridge does that have any effect on growth?
Is it reproducible at all with more detailed logging (ideally
--log-enable info+ --log-enable trace+:amqp_0_10)? Obviously logs like
that grow pretty quickly so depending on the scale of the leak that may
not be feasible. It might give some clues though (then again it might
not :-(). Perhaps even a short run from both co-located and remote cases
to see if a comparison shows anything up?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
On 12/03/12 23:52, William Henry wrote:
> Are you using acknowledgements on your federated bridge?
> That's what I"m wondering. You mention one exchange and one queue but
> with federation involved there is more going on. Which queue is the
> 1GB ring queue? I assume the final queue in the federation. Therefore
> I too wonder if the origin broker filling up because it's not getting
> acks that the messages have been consumed.
>
> ??
Hi Gordon & William.
As far as I'm aware we're not using acknowledgements, what I mean is
that I believe that the default with qpid-route is for no acks, I think
it sends messages via an unreliable link. I thought that you explicitly
had to enable acks with the --ack= option in qpid-route? have I missed
something?
Re "You mention one exchange and one queue but with federation involved
there is more going on. Which queue is the 1GB ring queue? I assume the
final queue in the federation ". I meant on the source broker, which is
the one causing the pain it's co-located with the producer.
In theory it's quite a simple set-up we have a producer that generates
data and populates headers describing the different types of data it
produces, this publishes to amq.match on its local broker the local
broker has a 1GB ring queue and a simple x-match: all binding to deliver
all of the messages to that queue, we then have a queue route
established to our "core" broker. That destination broker has a number
of consumers each subscribing to some subset of the data that the
producer is generating and each consumer has a 2GB ring queue.
The route is a source route because we don't want the performance
penalty of persistence and can tolerate some message loss and by using
source routes if the producer fails and restarts we don't get into the
pain whereby "normal" routes would try to reconnect the link then
silently fail because the queue isn't yet in place, so with source
routes we have a script that when the broker starts it re-creates the
queue and the binding then re-establishes the route in the correct order.
So it's not all that complicated, but it's driving me nuts that when the
source broker is co-located with the producer we have a memory increase,
but when we host the source broker on a different box it seems to be fine.
As I said in previous posts it seems to be exacerbated when the network
is dodgy so I too initially suspected an acknowledgement issue, but as I
say as far as I'm aware federation links are unreliable and don't
require acknowledgement "by default".
As always Murphys law kicks in and I've never seen this issue in my set
up at home where I've got a lot more control - only at work where I've
got pressures of deadlines :-)
The only time I've actually seen qpidd really eat memory is when I
deliberately screwed up a C++ consumer to not acknowledge so the ack
thing is plausible except that at the rate we're pushing messages if
there was something really messed it would crash and burn quicker than
we're seeing, it's a good deal more subtle than that.
BTW to answer one of Gordon's previous questions we're running RHEL5.4
however your comment "where a the per-thread pools of memory didn't work
well in the case of a thread that always worked on producing (hence
allocating) and another that did all the consuming (hence freeing).". I
*guess* we must have a similar situation to that with a single queue on
the source broker and our producer delivering data to amq.match on that
and the federation link consuming, but it is RHEL5.4 not RHEL6 I've no
idea how we'd identify if this scenario is affecting us too - is there a
way to work out if that issue is actually kicking in?
Also I'm thinking it's not a Boost issue (which is one of the other
straws I was clutching) we've checked the server qpid was built on and
the boxes giving pain and they are running the same Boost version (1.33
something I think).
I'd appreciate any more thoughts you guys may have.
Cheers,
Frase
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by William Henry <wh...@redhat.com>.
----- Original Message -----
> On 03/09/2012 04:10 PM, Fraser Adams wrote:
> > On 09/03/12 14:22, Gordon Sim wrote:
> >>
> >> Can you (or have you) tracked the queue depth, connection and
> >> session
> >> stats for the broker exhibiting the problem? Anything you can
> >> think of
> >> that might correlate with the rate of growth (e.g. does it look
> >> like
> >> its per message)?
> >>
> > Unfortunately nothing looks especially anomalous. As I mentioned
> > earlier
> > in this thread we did have what I suspect was a dodgy network
> > switch
> > which caused the producer host NIC to negotiate half-duplex. That
> > hosed
> > network performance and caused things to back up on the (circular)
> > queue
> > and was also causing regular reconnections (not mega-fast ~every 10
> > minutes) so initially I wondered if that was where the problem may
> > lie,
> > however since we sorted the network problem it has been running as
> > fast
> > as I'd expect with nothing obvious in the logs (no reconnections
> > now)
> > and a queue that now stays pretty close to empty.
> >
> >>> As I say below we've got a 0.8 qpid::client producer delivering
> >>> to
> >>> amq.match on a broker co-located on the same host which is
> >>> federated to
> >>> another 0.8 broker (all brokers are c++) via a source queue
> >>> route.
> >>
> >> That is all that's happening on the problem broker?
> >>
> > Yeah the problem broker doesn't have much going on at all. It has a
> > single queue, the producer is writing to amq.match and there are a
> > couple of matches in the x-match-all binding. The queue is sized to
> > 1G
> > the server has 24GB. The queue is a basic in-memory ring queue so
> > no
> > persistence or anything going on.
> >
> > We are using source routes set up with qpid-config -s
> >
> > That has me thinking I guess that I should standard routes just to
> > rule
> > out source routes as a potential problem. I don't suppose you are
> > aware
> > of any potential issues with source routes (he says clutching at
> > straws....)
>
> Definitely worth trying as that is the less travelled path and its
> always possible there is something we haven't seen before. There is
> nothing I'm aware of however.
>
> Are you using acknowledgements on your federated bridge?
That's what I"m wondering. You mention one exchange and one queue but
with federation involved there is more going on. Which queue is the
1GB ring queue? I assume the final queue in the federation. Therefore
I too wonder if the origin broker filling up because it's not getting
acks that the messages have been consumed.
??
Can you check both brokers for exchange and queue stats?
William
>
> > The producer is a slightly unusual fairly real time thing that
> > mmaps
> > it's main chunk of memory and uses an internal memory pool to
> > optimise
> > multi-threaded memory access but I believe that it is only grabbing
> > ~8GB
> >> rpm -qv <name> will give you the versioned name of the rpms which
> >> may
> >> shed some light...
> >>
> > Is there a list of libraries that qpid has dependencies on
> > available
> > anywhere so I can compare the info I get from the above command
> > with
> > what *should* be in place on the host?
>
> There is no formal list. Many (most?) of them are optional also, so
> it
> depends what you compiled with. Boost is the key dependency and you
> do
> want to make sure you use the same version of boost that you compiled
> against. Not doing so causes problems, though usually more pronounced
> than this so I don't suggest that is your issue.
>
> What versions of the qpid rpms and boost are you using on the two
> boxes?
>
> >> Nothing that should cause leaks... are you running any RHEL6?
> > I *think* it might be RHEL5, unfortunately I can't check at the
> > moment
> > as I'm mailing from home. Why did you ask about RHEL6, are there
> > any
> > issues with that?
>
> There was an issue with the memory allocation strategy in RHEL6,
> where a
> the per-thread pools of memory didn't work well in the case of a
> thread
> that always worked on producing (hence allocating) and another that
> did
> all the consuming (hence freeing).
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Gordon Sim <gs...@redhat.com>.
On 03/09/2012 04:10 PM, Fraser Adams wrote:
> On 09/03/12 14:22, Gordon Sim wrote:
>>
>> Can you (or have you) tracked the queue depth, connection and session
>> stats for the broker exhibiting the problem? Anything you can think of
>> that might correlate with the rate of growth (e.g. does it look like
>> its per message)?
>>
> Unfortunately nothing looks especially anomalous. As I mentioned earlier
> in this thread we did have what I suspect was a dodgy network switch
> which caused the producer host NIC to negotiate half-duplex. That hosed
> network performance and caused things to back up on the (circular) queue
> and was also causing regular reconnections (not mega-fast ~every 10
> minutes) so initially I wondered if that was where the problem may lie,
> however since we sorted the network problem it has been running as fast
> as I'd expect with nothing obvious in the logs (no reconnections now)
> and a queue that now stays pretty close to empty.
>
>>> As I say below we've got a 0.8 qpid::client producer delivering to
>>> amq.match on a broker co-located on the same host which is federated to
>>> another 0.8 broker (all brokers are c++) via a source queue route.
>>
>> That is all that's happening on the problem broker?
>>
> Yeah the problem broker doesn't have much going on at all. It has a
> single queue, the producer is writing to amq.match and there are a
> couple of matches in the x-match-all binding. The queue is sized to 1G
> the server has 24GB. The queue is a basic in-memory ring queue so no
> persistence or anything going on.
>
> We are using source routes set up with qpid-config -s
>
> That has me thinking I guess that I should standard routes just to rule
> out source routes as a potential problem. I don't suppose you are aware
> of any potential issues with source routes (he says clutching at
> straws....)
Definitely worth trying as that is the less travelled path and its
always possible there is something we haven't seen before. There is
nothing I'm aware of however.
Are you using acknowledgements on your federated bridge?
> The producer is a slightly unusual fairly real time thing that mmaps
> it's main chunk of memory and uses an internal memory pool to optimise
> multi-threaded memory access but I believe that it is only grabbing ~8GB
>> rpm -qv <name> will give you the versioned name of the rpms which may
>> shed some light...
>>
> Is there a list of libraries that qpid has dependencies on available
> anywhere so I can compare the info I get from the above command with
> what *should* be in place on the host?
There is no formal list. Many (most?) of them are optional also, so it
depends what you compiled with. Boost is the key dependency and you do
want to make sure you use the same version of boost that you compiled
against. Not doing so causes problems, though usually more pronounced
than this so I don't suggest that is your issue.
What versions of the qpid rpms and boost are you using on the two boxes?
>> Nothing that should cause leaks... are you running any RHEL6?
> I *think* it might be RHEL5, unfortunately I can't check at the moment
> as I'm mailing from home. Why did you ask about RHEL6, are there any
> issues with that?
There was an issue with the memory allocation strategy in RHEL6, where a
the per-thread pools of memory didn't work well in the case of a thread
that always worked on producing (hence allocating) and another that did
all the consuming (hence freeing).
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
On 09/03/12 14:22, Gordon Sim wrote:
>
> Can you (or have you) tracked the queue depth, connection and session
> stats for the broker exhibiting the problem? Anything you can think of
> that might correlate with the rate of growth (e.g. does it look like
> its per message)?
>
Unfortunately nothing looks especially anomalous. As I mentioned earlier
in this thread we did have what I suspect was a dodgy network switch
which caused the producer host NIC to negotiate half-duplex. That hosed
network performance and caused things to back up on the (circular) queue
and was also causing regular reconnections (not mega-fast ~every 10
minutes) so initially I wondered if that was where the problem may lie,
however since we sorted the network problem it has been running as fast
as I'd expect with nothing obvious in the logs (no reconnections now)
and a queue that now stays pretty close to empty.
>> As I say below we've got a 0.8 qpid::client producer delivering to
>> amq.match on a broker co-located on the same host which is federated to
>> another 0.8 broker (all brokers are c++) via a source queue route.
>
> That is all that's happening on the problem broker?
>
Yeah the problem broker doesn't have much going on at all. It has a
single queue, the producer is writing to amq.match and there are a
couple of matches in the x-match-all binding. The queue is sized to 1G
the server has 24GB. The queue is a basic in-memory ring queue so no
persistence or anything going on.
We are using source routes set up with qpid-config -s
That has me thinking I guess that I should standard routes just to rule
out source routes as a potential problem. I don't suppose you are aware
of any potential issues with source routes (he says clutching at straws....)
The producer is a slightly unusual fairly real time thing that mmaps
it's main chunk of memory and uses an internal memory pool to optimise
multi-threaded memory access but I believe that it is only grabbing ~8GB
> rpm -qv <name> will give you the versioned name of the rpms which may
> shed some light...
>
Is there a list of libraries that qpid has dependencies on available
anywhere so I can compare the info I get from the above command with
what *should* be in place on the host?
> Nothing that should cause leaks... are you running any RHEL6?
I *think* it might be RHEL5, unfortunately I can't check at the moment
as I'm mailing from home. Why did you ask about RHEL6, are there any
issues with that?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Gordon Sim <gs...@redhat.com>.
On 03/09/2012 10:04 AM, Fraser Adams wrote:
> I don't suppose anyone has had any more thoughts on this.
>
> Unfortunately sorting out our network problem hasn't resolved this
> issue, it does take a lot longer for the broker memory to grow but
> unfortunately it still does.
Can you (or have you) tracked the queue depth, connection and session
stats for the broker exhibiting the problem? Anything you can think of
that might correlate with the rate of growth (e.g. does it look like its
per message)?
> As I say below we've got a 0.8 qpid::client producer delivering to
> amq.match on a broker co-located on the same host which is federated to
> another 0.8 broker (all brokers are c++) via a source queue route.
That is all that's happening on the problem broker?
> One weird thing: As an experiment we kept the general topology the same
> but we moved the first broker on to its own host "just to see", so we've
> got the producer on one host writing to amq.match on a broker now on a
> different host with that broker federated to the core broker as before.
> We've had that running for days now and the brokers all seem to be
> stable!!!
>
> Has anyone seen circumstances that could cause brokers to appear to leak
> memory when co-located with a producer but be fine when run on a
> separate host??
No.
> I don't believe that there are any significant differences in the
> dependent libraries on each host, but I couldn't swear to it is anyone
> aware of stability issues say with particular versions of boost and qpid
> or indeed any other library.
>
> Annoyingly I've never noticed things like this in my set up at home,
> just at work where it matters more and I've got deadlines to meet :-(
>
> Can anyone think of a good way to "profile" our hosts to verify that
> they should be able to run qpid with no issues? I always build from
> source at home (that has its own issues on Ubuntu!!!!) but at work I
> believe qpid had been installed from RPMs I'm not clear on the
> provenance of the RPMs though I'm a bit suspicious of them they don't
> appear to have many dependency checks (for example it didn't barf when
> SASL wasn't present but that seems necessary even with --auth no).
>
> So one possibility for the carnage I'm seeing is some hosts might have
> slightly different versions of dependent libraries hence why I'd like to
> know in a systematic manner what to check for.
rpm -qv <name> will give you the versioned name of the rpms which may
shed some light...
I can't think of any known bug that could explain this. Its just
possible that some combination of versions on federation result in
mismatched expectations I suppose.
> On a related note is anyone aware of any differences in behaviour
> relating to hardware/chipset? All of our hosts are running RHEL but they
> are a mix of hardware - all Intel but varying numbers of cores and
> chipsets.
Nothing that should cause leaks... are you running any RHEL6?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
I don't suppose anyone has had any more thoughts on this.
Unfortunately sorting out our network problem hasn't resolved this
issue, it does take a lot longer for the broker memory to grow but
unfortunately it still does.
As I say below we've got a 0.8 qpid::client producer delivering to
amq.match on a broker co-located on the same host which is federated to
another 0.8 broker (all brokers are c++) via a source queue route.
One weird thing: As an experiment we kept the general topology the same
but we moved the first broker on to its own host "just to see", so we've
got the producer on one host writing to amq.match on a broker now on a
different host with that broker federated to the core broker as before.
We've had that running for days now and the brokers all seem to be stable!!!
Has anyone seen circumstances that could cause brokers to appear to leak
memory when co-located with a producer but be fine when run on a
separate host??
I don't believe that there are any significant differences in the
dependent libraries on each host, but I couldn't swear to it is anyone
aware of stability issues say with particular versions of boost and qpid
or indeed any other library.
Annoyingly I've never noticed things like this in my set up at home,
just at work where it matters more and I've got deadlines to meet :-(
Can anyone think of a good way to "profile" our hosts to verify that
they should be able to run qpid with no issues? I always build from
source at home (that has its own issues on Ubuntu!!!!) but at work I
believe qpid had been installed from RPMs I'm not clear on the
provenance of the RPMs though I'm a bit suspicious of them they don't
appear to have many dependency checks (for example it didn't barf when
SASL wasn't present but that seems necessary even with --auth no).
So one possibility for the carnage I'm seeing is some hosts might have
slightly different versions of dependent libraries hence why I'd like to
know in a systematic manner what to check for.
On a related note is anyone aware of any differences in behaviour
relating to hardware/chipset? All of our hosts are running RHEL but they
are a mix of hardware - all Intel but varying numbers of cores and chipsets.
I'm getting a bit desperate now there are project managers with cattle
prods heading my way :-(
heeeeelllllpppp!!!
Frase
On 01/03/12 15:04, Gordon Sim wrote:
> On 02/29/2012 07:07 PM, Fraser Adams wrote:
>> Hi All,
>> I think that we may have stumbled across a potential memory/resource
>> leak.
>>
>> We have one particular set up where we have a C++ producer client (using
>> qpid::client - don't ask, it's a long story.....) this writes to a 0.8
>> broker hosted on the same server. That broker is then federated via a
>> queue route to amq.match on another (0.8) broker. The queue route is a
>> source route set up via qpid-route -s
>>
>> We've been having all sorts of fun and games with respect to
>> performance, which we've narrowed down to some dodgy networking.
>>
>> However one of the other effects that we've noticed is that the broker
>> co-located with the producer client eats memory. The queue for the queue
>> route is 1GB but qpidd eventually grows to ~35GB and sends the whole set
>> up into swap.
>>
>> So with respect to the network problem we're suspecting a dodgy switch
>> somewhere, what is interesting is that when we checked with ethtool the
>> NIC was reporting half duplex had been negotiated - ouch!!! hence why we
>> suspect a dodgy switch somewhere.
>>
>> Now when the NIC was explicitly set to 100 base/T full duplex our
>> performance rocketed and the broker on the producer system appears
>> (touch wood) to have stable memory performance.
>>
>> What I'm suspecting is that the dodgy network link has been causing
>> connection drop-outs and the broker is automatically reconnecting (logs
>> are confirming this) and I'm thinking that there is a resource leak
>> somewhere during the reconnection process.
>
> https://issues.apache.org/jira/browse/QPID-3447 perhaps? Though I
> wouldn't have expected that to cause such a large growth in memory.
>
> Your sure there is no backed up queue anywhere?
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Fraser Adams <fr...@blueyonder.co.uk>.
Re
"Your sure there is no backed up queue anywhere?"
Pretty sure, it's a C++ producer sending messages to amq.match to a
broker on the same host, that broker has a single 1GB queue for the
queue route federated to the destination broker. The queue for the queue
route has been set up with ring policy e.g. circular queue.
At some stage the queue could well have filled, but it's a circular
queue so I wouldn't expect to see qpidd consume more than a few GB
certainly not 35GB
So what we're seeing is
crappy network = broker memory creeps up until the system eventually
dies under the weight of swapping
decent network = broker memory behaves as one would expect
We're seeing connection closed messages in the logs when the network is
behaving poorly.
I'd agree that It does seem weird that simple reconnections should
appear to cause such a large growth but it does appear to be a
consistent pattern and I can't think of any other explanation.
The queue is a 1GB circular non-persistent queue bound to amq.match via
a couple of fairly basic headers.
I did wonder if there was some headers exchange weirdness going on as
that seems less well supported than the other message patterns, we're
using queue routes because we want to be able to have a non-default size
and ring policy, but with 0.8 we had no other choice anyway as there was
a bug with dynamic routes (I know you fixed that in 0.12) and qpid-route
doesn't support static routes using amg.match so I'm slightly suspicious
that we might see something unusual as I think we may use the headers
exchange more than most.
I'm not convinced the Jira you mentioned is related as we're definitely
supplying the correct federation information, in our case the network
problem seems to be causing the connection to drop periodically out and
auto-reconnect.
Frase
On 01/03/12 15:04, Gordon Sim wrote:
> On 02/29/2012 07:07 PM, Fraser Adams wrote:
>> Hi All,
>> I think that we may have stumbled across a potential memory/resource
>> leak.
>>
>> We have one particular set up where we have a C++ producer client (using
>> qpid::client - don't ask, it's a long story.....) this writes to a 0.8
>> broker hosted on the same server. That broker is then federated via a
>> queue route to amq.match on another (0.8) broker. The queue route is a
>> source route set up via qpid-route -s
>>
>> We've been having all sorts of fun and games with respect to
>> performance, which we've narrowed down to some dodgy networking.
>>
>> However one of the other effects that we've noticed is that the broker
>> co-located with the producer client eats memory. The queue for the queue
>> route is 1GB but qpidd eventually grows to ~35GB and sends the whole set
>> up into swap.
>>
>> So with respect to the network problem we're suspecting a dodgy switch
>> somewhere, what is interesting is that when we checked with ethtool the
>> NIC was reporting half duplex had been negotiated - ouch!!! hence why we
>> suspect a dodgy switch somewhere.
>>
>> Now when the NIC was explicitly set to 100 base/T full duplex our
>> performance rocketed and the broker on the producer system appears
>> (touch wood) to have stable memory performance.
>>
>> What I'm suspecting is that the dodgy network link has been causing
>> connection drop-outs and the broker is automatically reconnecting (logs
>> are confirming this) and I'm thinking that there is a resource leak
>> somewhere during the reconnection process.
>
> https://issues.apache.org/jira/browse/QPID-3447 perhaps? Though I
> wouldn't have expected that to cause such a large growth in memory.
>
> Your sure there is no backed up queue anywhere?
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project: http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org
Re: C++ broker memory leak in federated set-up???
Posted by Gordon Sim <gs...@redhat.com>.
On 02/29/2012 07:07 PM, Fraser Adams wrote:
> Hi All,
> I think that we may have stumbled across a potential memory/resource leak.
>
> We have one particular set up where we have a C++ producer client (using
> qpid::client - don't ask, it's a long story.....) this writes to a 0.8
> broker hosted on the same server. That broker is then federated via a
> queue route to amq.match on another (0.8) broker. The queue route is a
> source route set up via qpid-route -s
>
> We've been having all sorts of fun and games with respect to
> performance, which we've narrowed down to some dodgy networking.
>
> However one of the other effects that we've noticed is that the broker
> co-located with the producer client eats memory. The queue for the queue
> route is 1GB but qpidd eventually grows to ~35GB and sends the whole set
> up into swap.
>
> So with respect to the network problem we're suspecting a dodgy switch
> somewhere, what is interesting is that when we checked with ethtool the
> NIC was reporting half duplex had been negotiated - ouch!!! hence why we
> suspect a dodgy switch somewhere.
>
> Now when the NIC was explicitly set to 100 base/T full duplex our
> performance rocketed and the broker on the producer system appears
> (touch wood) to have stable memory performance.
>
> What I'm suspecting is that the dodgy network link has been causing
> connection drop-outs and the broker is automatically reconnecting (logs
> are confirming this) and I'm thinking that there is a resource leak
> somewhere during the reconnection process.
https://issues.apache.org/jira/browse/QPID-3447 perhaps? Though I
wouldn't have expected that to cause such a large growth in memory.
Your sure there is no backed up queue anywhere?
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org