Thanks for the suggestion, but I'm afraid it doesn't make any difference - I still get a crash.

I added the following lines to the end of the existing program:

catch (std::exception& e)
{
    cout << e.what() << endl;
}
catch (...)
{
    cout << "unknown error" << endl;
}

Neither of the catch blocks were hit. When I run the program under the debugger, the stack appears to have been corrupted:

>    msvcr90d.dll!61e937f8()
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr90d.dll]
     msvcr90d.dll!61e70b4b()
     msvcr90d.dll!61e72327()
     msvcr90d.dll!61e7223c()
     msvcr90d.dll!61e71b0a()
     msvcr90d.dll!61dfe2b2()
     ntdll.dll!76f55f79()
     ntdll.dll!76f55f4b()
     ntdll.dll!76f29812()
     ntdll.dll!76f55dd7()
     kernel32.dll!7597fbae()
     kernel32.dll!7597fbae()
     kernel32.dll!7597fbae()
     msvcr90d.dll!61e6fee2()
qpidclientd.dll!boost::function1<void,qpid::sys::Socket const &>::function1<void,qpid::sys::Socket const &><boost::_bi::bind_t<void,boost::_mfi::mf1<void,qpid::client::TCPConnector,qpid::sys::Socket const &>,boost::_bi::list2<boost::_bi::value<qpid::client::TCPConnector *>,boost::arg<1> > > >(boost::_bi::bind_t<void,boost::_mfi::mf1<void,qpid::client::TCPConnector,qpid::sys::Socket const &>,boost::_bi::list2<boost::_bi::value<qpid::client::TCPConnector *>,boost::arg<1> > > f={...}, int __formal=3338964) Line 723 + 0xd bytes C++ qpidclientd.dll!boost::detail::shared_count::~shared_count() Line 221 C++
     0060f034()



On 20/07/2010 11:09, Gordon Sim wrote:
On 07/20/2010 09:03 AM, Chris Howard wrote:
Hi,

I have a very simple C++ program that attempts to connect to a broker
running on localhost:

#include "qpid/messaging/Connection.h"
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
try
{
qpid::messaging::Connection connection =
qpid::messaging::Connection::open("amqp:tcp:localhost:5672");
connection.close();
}
catch (qpid::Exception& e)
{
cout << e.what() << endl;
}
}

Try catching std::exception. The exception handling has been cleaned up a lot since the 0.6 release (and now the API should only throw subclasses of qpid::types::Exception).

However, if the broker is not running, then the program crashes during
the call to Connection::open, rather than throwing a ConnectionException.

I see the following output:

2010-07-20 08:45:46 warning Connecting failed: No connection could be
made because the target machine actively refused it. :
(..\..\..\..\cpp\src\qpid\sys\windows\Socket.cpp:219)
2010-07-20 08:45:46 warning Connection closed
Press any key to continue . . .

I also see similar behaviour (in a more complicated program) if the
broker is closed while a session is in progress.
I am using qpid 0.6 and I am running on Windows Vista. Am I doing
something wrong?

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to