You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by pa...@gmx.at on 2011/06/07 11:14:38 UTC

Qpid c# client - 500 connections problem

Hi dear qpid-users,

i'm new to qpid and tried to access qpid over c#. I copied the c# sample 
from the qpid-doc and tried to send over 1000 messages - after 500 messages 
i always get a "Client max connection count limit exceeded: 500 connection 
refused".
I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is the 
mistake?

Here is my sample code 
(from http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf 
- example 2.3 on page 5)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Org.Apache.Qpid.Messaging;
namespace Qpid500Test
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 1000; i++)
{
String broker = args.Length > 0 ? args[0] : "localhost:5672";
String address = args.Length > 1 ? args[1] : "amq.topic";
Connection connection = null;
try
{
connection = new Connection(broker);
connection.Open();
Session session = connection.CreateSession();
Receiver receiver = session.CreateReceiver(address);
Sender sender = session.CreateSender(address);
sender.Send(new Message("Hello world!"));
Message message = new Message();
message = receiver.Fetch(DurationConstants.SECOND * 1);
Console.WriteLine("{0}", message.GetContent());
session.Acknowledge();
connection.Close();
}
catch (Exception e)
{
Console.WriteLine("Exception {0}.", e);
if (null != connection) connection.Close();
}
}
}
}

Thanks in advance,

Yours
Joe
    
-- 
 

NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

Re: Qpid c# client - 500 connections problem

Posted by pa...@gmx.at.
Hi Alan,

this is just a test szenario, but i think this is realistic - i plan to create a wcf service to encapsulate the c++ calls and ease access for other developers in the company - all qpid message send calls will be submitted through that service.

Although it's just a test szenario the sample should work because the connections are closed safely.

Cheers,
Joe

-------- Original-Nachricht --------
> Datum: Tue, 07 Jun 2011 09:37:40 -0400
> Von: Alan Conway <ac...@redhat.com>
> An: users@qpid.apache.org
> CC: paperman@gmx.at
> Betreff: Re: Qpid c# client - 500 connections problem

> On 06/07/2011 05:14 AM, paperman@gmx.at wrote:
> > Hi dear qpid-users,
> >
> > i'm new to qpid and tried to access qpid over c#. I copied the c# sample
> > from the qpid-doc and tried to send over 1000 messages - after 500
> messages
> > i always get a "Client max connection count limit exceeded: 500
> connection
> > refused".
> > I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is the
> > mistake?
> >
> 
> 2 points:
> 
> Set --max-connections on the broker to something large if you really want
> large 
> numbers of connections BUT
> 
> Your code is creating a brand new connection for every message. I suspect
> you 
> really want to create the sender before the loop and send all your
> messages 
> using the same sender. Setting up and tearing down a connection for every 
> message is going to be very slow.
> 
> Cheers,
> Alan.
> 
> > Here is my sample code
> > (from
> http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
> > - example 2.3 on page 5)
> >
> > using System;
> > using System.Collections.Generic;
> > using System.Linq;
> > using System.Text;
> > using Org.Apache.Qpid.Messaging;
> > namespace Qpid500Test
> > {
> > class Program
> > {
> > static void Main(string[] args)
> > {
> > for (int i = 0; i<  1000; i++)
> > {
> > String broker = args.Length>  0 ? args[0] : "localhost:5672";
> > String address = args.Length>  1 ? args[1] : "amq.topic";
> > Connection connection = null;
> > try
> > {
> > connection = new Connection(broker);
> > connection.Open();
> > Session session = connection.CreateSession();
> > Receiver receiver = session.CreateReceiver(address);
> > Sender sender = session.CreateSender(address);
> > sender.Send(new Message("Hello world!"));
> > Message message = new Message();
> > message = receiver.Fetch(DurationConstants.SECOND * 1);
> > Console.WriteLine("{0}", message.GetContent());
> > session.Acknowledge();
> > connection.Close();
> > }
> > catch (Exception e)
> > {
> > Console.WriteLine("Exception {0}.", e);
> > if (null != connection) connection.Close();
> > }
> > }
> > }
> > }
> >
> > Thanks in advance,
> >
> > Yours
> > Joe
> >
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 

-- 
 

NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

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


Re: Qpid c# client - 500 connections problem

Posted by Alan Conway <ac...@redhat.com>.
On 06/07/2011 05:14 AM, paperman@gmx.at wrote:
> Hi dear qpid-users,
>
> i'm new to qpid and tried to access qpid over c#. I copied the c# sample
> from the qpid-doc and tried to send over 1000 messages - after 500 messages
> i always get a "Client max connection count limit exceeded: 500 connection
> refused".
> I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is the
> mistake?
>

2 points:

Set --max-connections on the broker to something large if you really want large 
numbers of connections BUT

Your code is creating a brand new connection for every message. I suspect you 
really want to create the sender before the loop and send all your messages 
using the same sender. Setting up and tearing down a connection for every 
message is going to be very slow.

Cheers,
Alan.

> Here is my sample code
> (from http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
> - example 2.3 on page 5)
>
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using Org.Apache.Qpid.Messaging;
> namespace Qpid500Test
> {
> class Program
> {
> static void Main(string[] args)
> {
> for (int i = 0; i<  1000; i++)
> {
> String broker = args.Length>  0 ? args[0] : "localhost:5672";
> String address = args.Length>  1 ? args[1] : "amq.topic";
> Connection connection = null;
> try
> {
> connection = new Connection(broker);
> connection.Open();
> Session session = connection.CreateSession();
> Receiver receiver = session.CreateReceiver(address);
> Sender sender = session.CreateSender(address);
> sender.Send(new Message("Hello world!"));
> Message message = new Message();
> message = receiver.Fetch(DurationConstants.SECOND * 1);
> Console.WriteLine("{0}", message.GetContent());
> session.Acknowledge();
> connection.Close();
> }
> catch (Exception e)
> {
> Console.WriteLine("Exception {0}.", e);
> if (null != connection) connection.Close();
> }
> }
> }
> }
>
> Thanks in advance,
>
> Yours
> Joe
>

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


Re: Qpid c# client - 500 connections problem

Posted by Pavel Moravec <pm...@redhat.com>.
Hi all,
I think the default 500 connections are hard-coded, even in qpid-0.10:

-- where the log appears from:
cpp/src/qpid/broker/ConnectionFactory.cpp:45:        QPID_LOG(error, "Client max connection count limit exceeded: " << broker.getOptions().maxConnections << " connection refused");

-- where the variable is initialised:
cpp/src/qpid/broker/Broker.cpp:107:    maxConnections(500),
cpp/src/qpid/broker/Broker.cpp:197:    connectionCounter(conf.maxConnections),

-- how the property is configurable (Alan Conway mentioned this earlier):
cpp/src/qpid/broker/Broker.cpp:142:        ("max-connections", optValue(maxConnections, "N"), "Sets the maximum allowed connections")



Kind regards,
Pavel


----- Original Message -----
From: paperman@gmx.at
To: users@qpid.apache.org, users@qpid.apache.org
Sent: Tuesday, June 7, 2011 4:34:26 PM
Subject: Re: Qpid c# client - 500 connections problem

Hi Chuck,

unfortunately the erros all occur localhost under Win XP 32bit with qpid 0.10 as c# client AND 0.10 c++ broker.

I try to install qpid under linux ... although i think there must be another problem.

Joe

-------- Original-Nachricht --------
> Datum: Tue, 7 Jun 2011 09:37:50 -0400 (EDT)
> Von: Chuck Rolke <cr...@redhat.com>
> An: users@qpid.apache.org
> Betreff: Re: Qpid c# client - 500 connections problem

> Hi Joe,
> 
> I think this issue is actually with the broker and not with the client. I
> had the same issue when running against a 0.8 windows broker; the issue
> does not exist for 0.8 linux brokers. See issue
> https://issues.apache.org/jira/browse/QPID-2967 
> 
> The fix for this was checked in after the 0.8 release and is in 0.10. You
> can try running a 0.10 broker or running against a linux broker.
> 
> Another test to prove this theory is to run 500 connections on the client
> and then pause. Restart the broker and resume the client and it should do
> another 500 connections.
> 
> -Chuck
> 
> ----- Original Message -----
> > From: paperman@gmx.at
> > To: users@qpid.apache.org
> > Sent: Tuesday, June 7, 2011 5:14:38 AM
> > Subject: Qpid c# client - 500 connections problem
> > Hi dear qpid-users,
> > 
> > i'm new to qpid and tried to access qpid over c#. I copied the c#
> > sample
> > from the qpid-doc and tried to send over 1000 messages - after 500
> > messages
> > i always get a "Client max connection count limit exceeded: 500
> > connection
> > refused".
> > I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is
> > the
> > mistake?
> > 
> > Here is my sample code
> > (from
> >
> http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
> > - example 2.3 on page 5)
> > 
> > using System;
> > using System.Collections.Generic;
> > using System.Linq;
> > using System.Text;
> > using Org.Apache.Qpid.Messaging;
> > namespace Qpid500Test
> > {
> > class Program
> > {
> > static void Main(string[] args)
> > {
> > for (int i = 0; i < 1000; i++)
> > {
> > String broker = args.Length > 0 ? args[0] : "localhost:5672";
> > String address = args.Length > 1 ? args[1] : "amq.topic";
> > Connection connection = null;
> > try
> > {
> > connection = new Connection(broker);
> > connection.Open();
> > Session session = connection.CreateSession();
> > Receiver receiver = session.CreateReceiver(address);
> > Sender sender = session.CreateSender(address);
> > sender.Send(new Message("Hello world!"));
> > Message message = new Message();
> > message = receiver.Fetch(DurationConstants.SECOND * 1);
> > Console.WriteLine("{0}", message.GetContent());
> > session.Acknowledge();
> > connection.Close();
> > }
> > catch (Exception e)
> > {
> > Console.WriteLine("Exception {0}.", e);
> > if (null != connection) connection.Close();
> > }
> > }
> > }
> > }
> > 
> > Thanks in advance,
> > 
> > Yours
> > Joe
> > 
> > --
> > 
> > 
> > NEU: FreePhone - kostenlos mobil telefonieren!
> > Jetzt informieren: http://www.gmx.net/de/go/freephone
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 

-- 
 

NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

---------------------------------------------------------------------
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: Qpid c# client - 500 connections problem

Posted by pa...@gmx.at.
Thank you very much, Chuck!
-- 
 

NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

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


Re: Qpid c# client - 500 connections problem

Posted by Chuck Rolke <cr...@redhat.com>.
Hi Joe,

There is another problem. 
I've filed a case at https://issues.apache.org/jira/browse/QPID-3294

Regards,
Chuck

----- Original Message -----
> From: paperman@gmx.at
> To: users@qpid.apache.org, users@qpid.apache.org
> Sent: Tuesday, June 7, 2011 10:34:26 AM
> Subject: Re: Qpid c# client - 500 connections problem
> Hi Chuck,
> 
> unfortunately the erros all occur localhost under Win XP 32bit with
> qpid 0.10 as c# client AND 0.10 c++ broker.
> 
> I try to install qpid under linux ... although i think there must be
> another problem.
> 
> Joe
> 
> -------- Original-Nachricht --------
> > Datum: Tue, 7 Jun 2011 09:37:50 -0400 (EDT)
> > Von: Chuck Rolke <cr...@redhat.com>
> > An: users@qpid.apache.org
> > Betreff: Re: Qpid c# client - 500 connections problem
> 
> > Hi Joe,
> >
> > I think this issue is actually with the broker and not with the
> > client. I
> > had the same issue when running against a 0.8 windows broker; the
> > issue
> > does not exist for 0.8 linux brokers. See issue
> > https://issues.apache.org/jira/browse/QPID-2967
> >
> > The fix for this was checked in after the 0.8 release and is in
> > 0.10. You
> > can try running a 0.10 broker or running against a linux broker.
> >
> > Another test to prove this theory is to run 500 connections on the
> > client
> > and then pause. Restart the broker and resume the client and it
> > should do
> > another 500 connections.
> >
> > -Chuck
> >
> > ----- Original Message -----
> > > From: paperman@gmx.at
> > > To: users@qpid.apache.org
> > > Sent: Tuesday, June 7, 2011 5:14:38 AM
> > > Subject: Qpid c# client - 500 connections problem
> > > Hi dear qpid-users,
> > >
> > > i'm new to qpid and tried to access qpid over c#. I copied the c#
> > > sample
> > > from the qpid-doc and tried to send over 1000 messages - after 500
> > > messages
> > > i always get a "Client max connection count limit exceeded: 500
> > > connection
> > > refused".
> > > I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where
> > > is
> > > the
> > > mistake?
> > >
> > > Here is my sample code
> > > (from
> > >
> > http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
> > > - example 2.3 on page 5)
> > >
> > > using System;
> > > using System.Collections.Generic;
> > > using System.Linq;
> > > using System.Text;
> > > using Org.Apache.Qpid.Messaging;
> > > namespace Qpid500Test
> > > {
> > > class Program
> > > {
> > > static void Main(string[] args)
> > > {
> > > for (int i = 0; i < 1000; i++)
> > > {
> > > String broker = args.Length > 0 ? args[0] : "localhost:5672";
> > > String address = args.Length > 1 ? args[1] : "amq.topic";
> > > Connection connection = null;
> > > try
> > > {
> > > connection = new Connection(broker);
> > > connection.Open();
> > > Session session = connection.CreateSession();
> > > Receiver receiver = session.CreateReceiver(address);
> > > Sender sender = session.CreateSender(address);
> > > sender.Send(new Message("Hello world!"));
> > > Message message = new Message();
> > > message = receiver.Fetch(DurationConstants.SECOND * 1);
> > > Console.WriteLine("{0}", message.GetContent());
> > > session.Acknowledge();
> > > connection.Close();
> > > }
> > > catch (Exception e)
> > > {
> > > Console.WriteLine("Exception {0}.", e);
> > > if (null != connection) connection.Close();
> > > }
> > > }
> > > }
> > > }
> > >
> > > Thanks in advance,
> > >
> > > Yours
> > > Joe
> > >
> > > --
> > >
> > >
> > > NEU: FreePhone - kostenlos mobil telefonieren!
> > > Jetzt informieren: http://www.gmx.net/de/go/freephone
> >
> > ---------------------------------------------------------------------
> > Apache Qpid - AMQP Messaging Implementation
> > Project: http://qpid.apache.org
> > Use/Interact: mailto:users-subscribe@qpid.apache.org
> >
> 
> --
> 
> 
> NEU: FreePhone - kostenlos mobil telefonieren!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
> 
> ---------------------------------------------------------------------
> 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: Qpid c# client - 500 connections problem

Posted by pa...@gmx.at.
Hi Chuck,

unfortunately the erros all occur localhost under Win XP 32bit with qpid 0.10 as c# client AND 0.10 c++ broker.

I try to install qpid under linux ... although i think there must be another problem.

Joe

-------- Original-Nachricht --------
> Datum: Tue, 7 Jun 2011 09:37:50 -0400 (EDT)
> Von: Chuck Rolke <cr...@redhat.com>
> An: users@qpid.apache.org
> Betreff: Re: Qpid c# client - 500 connections problem

> Hi Joe,
> 
> I think this issue is actually with the broker and not with the client. I
> had the same issue when running against a 0.8 windows broker; the issue
> does not exist for 0.8 linux brokers. See issue
> https://issues.apache.org/jira/browse/QPID-2967 
> 
> The fix for this was checked in after the 0.8 release and is in 0.10. You
> can try running a 0.10 broker or running against a linux broker.
> 
> Another test to prove this theory is to run 500 connections on the client
> and then pause. Restart the broker and resume the client and it should do
> another 500 connections.
> 
> -Chuck
> 
> ----- Original Message -----
> > From: paperman@gmx.at
> > To: users@qpid.apache.org
> > Sent: Tuesday, June 7, 2011 5:14:38 AM
> > Subject: Qpid c# client - 500 connections problem
> > Hi dear qpid-users,
> > 
> > i'm new to qpid and tried to access qpid over c#. I copied the c#
> > sample
> > from the qpid-doc and tried to send over 1000 messages - after 500
> > messages
> > i always get a "Client max connection count limit exceeded: 500
> > connection
> > refused".
> > I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is
> > the
> > mistake?
> > 
> > Here is my sample code
> > (from
> >
> http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
> > - example 2.3 on page 5)
> > 
> > using System;
> > using System.Collections.Generic;
> > using System.Linq;
> > using System.Text;
> > using Org.Apache.Qpid.Messaging;
> > namespace Qpid500Test
> > {
> > class Program
> > {
> > static void Main(string[] args)
> > {
> > for (int i = 0; i < 1000; i++)
> > {
> > String broker = args.Length > 0 ? args[0] : "localhost:5672";
> > String address = args.Length > 1 ? args[1] : "amq.topic";
> > Connection connection = null;
> > try
> > {
> > connection = new Connection(broker);
> > connection.Open();
> > Session session = connection.CreateSession();
> > Receiver receiver = session.CreateReceiver(address);
> > Sender sender = session.CreateSender(address);
> > sender.Send(new Message("Hello world!"));
> > Message message = new Message();
> > message = receiver.Fetch(DurationConstants.SECOND * 1);
> > Console.WriteLine("{0}", message.GetContent());
> > session.Acknowledge();
> > connection.Close();
> > }
> > catch (Exception e)
> > {
> > Console.WriteLine("Exception {0}.", e);
> > if (null != connection) connection.Close();
> > }
> > }
> > }
> > }
> > 
> > Thanks in advance,
> > 
> > Yours
> > Joe
> > 
> > --
> > 
> > 
> > NEU: FreePhone - kostenlos mobil telefonieren!
> > Jetzt informieren: http://www.gmx.net/de/go/freephone
> 
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
> 

-- 
 

NEU: FreePhone - kostenlos mobil telefonieren!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

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


Re: Qpid c# client - 500 connections problem

Posted by Chuck Rolke <cr...@redhat.com>.
Hi Joe,

I think this issue is actually with the broker and not with the client. I had the same issue when running against a 0.8 windows broker; the issue does not exist for 0.8 linux brokers. See issue https://issues.apache.org/jira/browse/QPID-2967 

The fix for this was checked in after the 0.8 release and is in 0.10. You can try running a 0.10 broker or running against a linux broker.

Another test to prove this theory is to run 500 connections on the client and then pause. Restart the broker and resume the client and it should do another 500 connections.

-Chuck

----- Original Message -----
> From: paperman@gmx.at
> To: users@qpid.apache.org
> Sent: Tuesday, June 7, 2011 5:14:38 AM
> Subject: Qpid c# client - 500 connections problem
> Hi dear qpid-users,
> 
> i'm new to qpid and tried to access qpid over c#. I copied the c#
> sample
> from the qpid-doc and tried to send over 1000 messages - after 500
> messages
> i always get a "Client max connection count limit exceeded: 500
> connection
> refused".
> I'm using qpid 0.10 32bit in c# 3.5. Can anybody help me - where is
> the
> mistake?
> 
> Here is my sample code
> (from
> http://qpid.apache.org/books/0.8/Programming-In-Apache-Qpid/pdf/Programming-In-Apache-Qpid.pdf
> - example 2.3 on page 5)
> 
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using Org.Apache.Qpid.Messaging;
> namespace Qpid500Test
> {
> class Program
> {
> static void Main(string[] args)
> {
> for (int i = 0; i < 1000; i++)
> {
> String broker = args.Length > 0 ? args[0] : "localhost:5672";
> String address = args.Length > 1 ? args[1] : "amq.topic";
> Connection connection = null;
> try
> {
> connection = new Connection(broker);
> connection.Open();
> Session session = connection.CreateSession();
> Receiver receiver = session.CreateReceiver(address);
> Sender sender = session.CreateSender(address);
> sender.Send(new Message("Hello world!"));
> Message message = new Message();
> message = receiver.Fetch(DurationConstants.SECOND * 1);
> Console.WriteLine("{0}", message.GetContent());
> session.Acknowledge();
> connection.Close();
> }
> catch (Exception e)
> {
> Console.WriteLine("Exception {0}.", e);
> if (null != connection) connection.Close();
> }
> }
> }
> }
> 
> Thanks in advance,
> 
> Yours
> Joe
> 
> --
> 
> 
> NEU: FreePhone - kostenlos mobil telefonieren!
> Jetzt informieren: http://www.gmx.net/de/go/freephone

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