I think you may be seeing the effect of the connect() call trying to contact a host that it can't readily contact. It should time out in a minute or two.
-Steve -- Steve Huston, Riverace Corporation Total Lifecycle Support for Your Networked Applications http://www.riverace.com > -----Original Message----- > From: _cristian_ [mailto:[email protected]] > Sent: Tuesday, March 02, 2010 11:06 AM > To: [email protected] > Subject: Connection.open get stuck with wrong host address > > > > Hello.I have written a simple program that tries to open a > connection to a qpid broker. > I am using qpid 0.5 on Centos5.4 x86_64. > > I have the following code : > /* > * File: main.cpp > * Author: root > * > * Created on March 2, 2010, 4:49 PM > */ > > #include <stdlib.h> > #include <qpid/client/Connection.h> > #include <qpid/client/Session.h> > #include <qpid/client/SubscriptionManager.h> > > #include <string> > #include <stdexcept> > using namespace std; > > int main(int argc, char** argv) { > qpid::client::Connection connection; > std::cout<<"Begin"<<std::endl; > try { > connection.open("host", 5672, "user", "password"); > } catch( std::exception &e) { > std::cout<<e.what()<<std::endl; > } catch(...) { > std::cout<<"errors"<<std::endl; > } > if( connection.isOpen() ) { > std::cout<<"Opened"<<std::endl; > } > std::cout<<"exit"<<std::endl; > return (EXIT_SUCCESS); > } > The problem is that if the first argument of connection.open > is not a valid host (for example an ip where there is no qpid > broker) the program gets stucked in the open() function. > This is the gdb backtrace when the host parameter is not > valid. The SIGINT signal is caused by me pressing CTRL +C . > > (gdb) run > Starting program: > /root/NetBeansProjects/test/dist/Debug/GNU-Linux-x86/test > [Thread debugging using libthread_db enabled] > [New Thread 0x2b9f6590f080 (LWP 18906)] > Begin > > Program received signal SIGINT, Interrupt. > 0x0000003fa14d44f0 in __connect_nocancel () from /lib64/libc.so.6 > (gdb) bt > #0 0x0000003fa14d44f0 in __connect_nocancel () from > /lib64/libc.so.6 #1 0x00002b9f64da7376 in > qpid::sys::Socket::connect (this=0x2675030, ho...@0x2682228, > p=<value optimized out>) at qpid/sys/posix/Socket.cpp:159 #2 > 0x00002b9f649cbb5d in qpid::client::TCPConnector::connect > (this=0x2674f40, ho...@0x2682228, port=5672) at > qpid/client/Connector.cpp:189 #3 0x00002b9f649bfacb in > qpid::client::ConnectionImpl::open > (this=0x2682130) at qpid/client/ConnectionImpl.cpp:137 > #4 0x00002b9f649b26f9 in qpid::client::Connection::open > (this=0x7fff7c9ea390, settin...@0xffffffff) at > qpid/client/Connection.cpp:122 #5 0x00002b9f649b2dce in > qpid::client::Connection::open (this=0x7fff7c9ea390, > ho...@0x7fff7c9ea400, port=5672, u...@0x7fff7c9ea3f0, > p...@0x7fff7c9ea3e0, > vho...@0x7fff7c9ea3d0, maxFrameSize=65535) at > qpid/client/Connection.cpp:100 #6 0x0000000000402201 in main > (argc=1, argv=0x7fff7c9ea518) at main.cpp:26 > > > -- > View this message in context: > http://n2.nabble.com/Connection-open-get-stuck-with-wrong-host -address-tp4661786p4661786.html Sent from the Apache Qpid developers mailing list archive at Nabble.com. --------------------------------------------------------------------- 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]
