On Thu, 10 Mar 2016 16:13:32 +0000, "James A. Robinson"
<j...@highwire.org> wrote:

It happens infrequently and unpredictibly.  For example sometimes it
fails after 25 times and sometimes it works for several 100 before
going wrong.

Another thing is that program works OK on Linux.  It's only on Solaris
that this problem arrises.

netstat does show a lot of connections in TIME_WAIT state.  I don't
know what control I have over the closedown -- I assume this is done
internally by ActiveMQ-CPP?

>You don't say how frequently it performs this action?  If it is frequent,
>and I were debugging it, the first thing I would check for would be that
>you haven't run out of socket filehandles.  On a unix system running
>something like "netstat -nt" can tell you what state the socket filehandles
>are in.  If there are too many in the TIME_WAIT state, for example, it can
>exhaust your available filehandles and it won't be able to make a new
>socket connection until the OS allows them to expire.  This exhaustion can
>easily happen if your program is only using a limited set of ports on the
>client side as well, and I could imagine that might be logged as an
>"address in use" error.
>
>Jim
>
>
>On Thu, Mar 10, 2016 at 8:07 AM Timothy Bish <tabish...@gmail.com> wrote:
>
>> On 03/10/2016 10:37 AM, spamtrap wrote:
>> > [ActiveMQ-CPP v3.9.0]
>> >
>> > We have a c++ program which connects to a broker, sends a message to a
>> > topic and then closes the connections & exits.  Every now and then it
>> > fails to connect reporting a "Address already in use" exception
>> > (based on ex.what()).
>> >
>> > The code is like this:
>> >
>> > ----- cut ------
>> >     try {
>> >       pConnectionFactory =
>> > cms::ConnectionFactory::createCMSConnectionFactory(
>> >               brokerURI);
>> >       pConnection = pConnectionFactory->createConnection();
>> >     } catch (cms::CMSException &ex)
>> >     {
>> >        fprintf(stderr, "CMSException: \n");
>> >        ex.printStackTrace();
>> >        ...
>> >     }
>> > ----- cut ------
>> >
>> > ex.printStackTrace prints nothing even though I am using the following
>> > connection string (broker URI):
>> > "tcp://localhost:61616?wireFormat.stackTraceEnabled=true"
>> >
>> > How can I get more information about this problem?
>> >
>> >
>> >
>> You'd need to do some debugging on the client end to see what is causing
>> this, not been reported before.
>>
>> --
>> Tim Bish
>> twitter: @tabish121
>> blog: http://timbish.blogspot.com/
>>
>>


Reply via email to