Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 43391 invoked from network); 6 Sep 2006 14:08:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Sep 2006 14:08:20 -0000 Received: (qmail 1207 invoked by uid 500); 6 Sep 2006 14:08:20 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 1187 invoked by uid 500); 6 Sep 2006 14:08:20 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 1178 invoked by uid 99); 6 Sep 2006 14:08:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Sep 2006 07:08:19 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [199.105.164.5] (HELO smtpmail2.sensis.com) (199.105.164.5) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Sep 2006 07:08:18 -0700 Received: from dimstar2.ats.sensis.com ([172.21.1.6]) by smtpmail2.sensis.com with esmtp (Exim 4.50) id 1GKy4L-0001zP-S5 for activemq-users@geronimo.apache.org; Wed, 06 Sep 2006 10:07:57 -0400 Received: from corpatsmail1.ats.sensis.com ([172.21.1.88] helo=corpatsmail1.corp.sensis.com) by dimstar2.ats.sensis.com with esmtp (Exim 4.50) id 1GKy3Q-0001H3-Uo for activemq-users@geronimo.apache.org; Wed, 06 Sep 2006 10:07:01 -0400 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Sockets not connecting ... Invalid handle returned Date: Wed, 6 Sep 2006 10:05:46 -0400 Message-ID: <5A211522579EBD4A83155ED7FA1530637FC4CD@corpatsmail1.corp.sensis.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Sockets not connecting ... Invalid handle returned Thread-Index: AcbRu6miXdeDLGzwRL2XpjG+3xPKpgAAQD+A From: "Bish, Tim" To: X-Sensis-MailScanner-Information: Scanned at Sensis Corporation by MailScanner X-Sensis-MailScanner: Found to be clean X-Sensis-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (score=-4.245, required 5, ALL_TRUSTED -1.80, BAYES_00 -2.60, TW_FP 0.08, TW_VF 0.08) X-Sensis-MailScanner-From: tim.bish@sensis.com X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Sounds like for whatever reason a socket can't be opened to the broker. You may have to step through the code in the tcpsocket::connect and see what line is failing. =20 The code from the website builds and runs fine here, you may need to refresh your browser cache to see the latest, or go right to SVN and get it from the examples folder in activemq-cpp. There is a VC++ 2005 project file in there as well. You can download 2005 for free, it may be worth it to try that and see if there is something in the settings that is different from yours. >=20 > Tim, >=20 > Actually my broker had gone down so i gave some wrong info ... problem is > something else, please go through this explanation of what i found. >=20 > If you look at the main function in the activemq-cpp client given on our > site > I am just pasting it here now. It says. >=20 > HelloWorldProducer producer( 1000 ); > HelloWorldConsumer consumer( 5000 ); >=20 > // Start the consumer thread. > Thread consumerThread( &consumer ); > consumerThread.start(); >=20 > // Start the producer thread. > Thread producerThread( &producer ); > producerThread.start(); >=20 > // Wait for the threads to complete. > producerThread.join(); > consumerThread.join(); >=20 > When I debug the call goes to > socket->connect( host, port ); // this is inside the class > bufferedsocket.cpp >=20 > after this it executes the connect method inside the class tcpsocket.cpp > but when the call comes out of this method it shows a INVALID HANDLE in > the > debug variable socket value >=20 > Then from the producer call again goes to > bufferedsocket.cpp and executes the > socket->connect(host, port); method >=20 > AFter all this is done > it bombs in the constructor of tcptransport.cpp > IOTransport* ioTransport =3D dynamic_cast( next = ); >=20 > and the value of the variable socket in debug mode at this point of time > before executing this statement is INVALID_SOCKET_HANDLE=3D??? >=20 > Here is the exception then >=20 > - ex {message=3D{"caught unknown exception"} stackTrace=3D{first=3D??? last=3D???} > } > activemq::exceptions::ActiveMQException & > - cms::CMSException {...} cms::CMSException > + __vfptr 0x00484278 const > activemq::exceptions::ActiveMQException::`vftable' * > - message {"caught unknown exception"} > std::basic_string,std::allocator > > - std::_String_val > {_Alval=3D{...} } > std::_String_val > > std::_String_base {...} const std::_String_base > + _Alval {...} std::allocator > - _Bx {_Buf=3D0x0069f9bc "po4" _Ptr=3D0x00346f70 "caught unknown exception" } > std::basic_string,std::allocator > >::_Bxty > + _Buf 0x0069f9bc "po4" char [16] > - _Ptr 0x00346f70 "caught unknown exception" char * > 99 'c' char > _Mysize 24 unsigned int > _Myres 31 unsigned int > - stackTrace {first=3D??? last=3D???} > std::vector,std: :a > llocator > >,int>,std::allocator ar>,std::allocator > >,int> > > > - > std::_Vector_val ,s > td::allocator > >,int>,std::allocator ar>,std::allocator > >,int> > > {_Alval=3D{...} } > std::_Vector_val ,s > td::allocator > >,int>,std::allocator ar>,std::allocator > >,int> > > > - _Alval {...} > std::allocator,s td > ::allocator > >,int> > >=20 > std::_Allocator_base r>,std::allocator > >,int> > {...} > std::_Allocator_base r>,std::allocator > >,int> > > - _Myfirst 0x00b82770 > {first=3D{"D:\PCData\cpp2\activemq-cpp\win32- > msvc\..\src\main\activemq\transport\TcpTransport.cpp"} > second=3D59} > std::pair,std::allocator r> > >,int> * > + first > {"D:\PCData\cpp2\activemq-cpp\win32- > msvc\..\src\main\activemq\transport\TcpTransport.cpp"} > std::basic_string,std::allocator > > second 59 int > - _Mylast 0x00b827b0 {first=3D{???} second=3D3473784} > std::pair,std::allocator r> > >,int> * > - first {???} > std::basic_string,std::allocator > > + std::_String_val > {_Alval=3D{...} } > std::_String_val > > + _Bx {_Buf=3D0x00b827b4 "<<<<" _Ptr=3D0xabababab } > std::basic_string,std::allocator > >::_Bxty > _Mysize 32380142 unsigned int > _Myres 3529288 unsigned int > second 3473784 int > - _Myend 0x00b827b0 {first=3D{???} second=3D3473784} > std::pair,std::allocator r> > >,int> * > - first {???} > std::basic_string,std::allocator > > + std::_String_val > {_Alval=3D{...} } > std::_String_val > > + _Bx {_Buf=3D0x00b827b4 "<<<<" _Ptr=3D0xabababab } > std::basic_string,std::allocator > >::_Bxty > _Mysize 32380142 unsigned int > _Myres 3529288 unsigned int > second 3473784 int >=20 > I have attached the piece of code as a file. The one that i have got > running > on my machine (client example given on site - bit modified since on the > site > it is outdated now). >=20 > Thanks >=20 >=20 > Bish, Tim wrote: > > > > So there are two different threads in the example code (main.cpp), each > > of them creates a connection to the broker. They each try and connect > > to the broker on the url "tcp://127.0.0.1:61613", so you need to ensure > > that you have the broker running on you local machine and have the stomp > > transport configured to be on port 61613, or you need to change this to > > be whatever ip and port the broker is at. > > > > Sounds like it fails on this call in each thread: > > > > connection =3D connectionFactory->createConnection(); > > > > So you need to debug what is breaking, the exception stack trace should > > give you some clues. Either run in a console window or alter the code > > to grab this data and store it in a logfile or something. > > > > }catch ( CMSException& e ) { > > e.printStackTrace(); > > } > > > > You can use one of these methods from CMSException to do this > > > > /** > > * Provides the stack trace for every point where > > * this exception was caught, marked, and rethrown. > > * @return vector containing stack trace strings > > */ > > virtual std::vector< std::pair< std::string, int> > > > getStackTrace() const =3D 0; > > > > /** > > * Prints the stack trace to the given output stream. > > * @param stream the target output stream. > > */ > > virtual void printStackTrace( std::ostream& stream ) const = =3D 0; > > > > > > Worse comes to worse you can step through the TcpSocket::connect method > > in the debugger to find out where exactly its breaking. > > > >> > >> If you look at the main function in the activemq-cpp client given on > > our > >> site > >> I am just pasting it here now. It says. > >> > >> HelloWorldProducer producer( 1000 ); > >> HelloWorldConsumer consumer( 5000 ); > >> > >> // Start the consumer thread. > >> Thread consumerThread( &consumer ); > >> consumerThread.start(); > >> > >> // Start the producer thread. > >> Thread producerThread( &producer ); > >> producerThread.start(); > >> > >> // Wait for the threads to complete. > >> producerThread.join(); > >> consumerThread.join(); > >> > >> When I debug the call goes to > >> connection =3D connectionFactory->createConnection(); // inside > >> HelloWorldConsumer.cpp and HelloWorldProducer.cpp > >> > >> It runs this piece of code in turn ... > >> if( status < 0 ){ > >> close(); > >> throw SocketException( __FILE__, __LINE__, > >> "Socket::connect - %s", ::strerror( errno ) ); > >> } > >> and throws the exception ... from the class tcpsocket.cpp > >> > >> > >> > >> Bish, Tim wrote: > >> > > >> >> > >> >> The following piece of code in the class SocketFactory.cpp is > > throwing > >> >> exceptions .... > >> >> BufferedSocket* socket =3D new BufferedSocket(tcpSocket, > >> >> inputBufferSize, outputBufferSize); > >> >> socket->connect( host.c_str(), port ); > >> >> > >> >> it returns an invalid handle actually. I can see the call coming in > >> > twice > >> >> to > >> >> this piece of code (producer and then the consumer ... both are > >> > threaded > >> >> and > >> >> do a join inside the main method). The second time the call comes > > in > >> > it > >> >> bombs. > >> > > >> > It shouldn't be calling the socket factory twice, especially not > > from > >> > producer and consumer as they have nothing to do with the sockets. > >> > > >> > What code are you trying to run? Example? > >> > > >> > If you run from a command window, what is the error that is printed > > out? > >> > > >> >> > >> >> Cant understand why this is happening ... any ideas on what could > > be > >> > the > >> >> reason. > >> >> I tried changing the port to 61614 for the broker and the code in > > the > >> >> client > >> >> too ... did not work still ... same probs. > >> >> > >> >> Any hint would be really useful. > >> >> -- > >> >> View this message in context: http://www.nabble.com/Sockets-not- > >> >> connecting-...-Invalid-handle-returned-tf2225941.html#a6168387 > >> >> Sent from the ActiveMQ - User forum at Nabble.com. > >> > > >> > > >> > > >> > >> -- > >> View this message in context: http://www.nabble.com/Sockets-not- > >> connecting-...-Invalid-handle-returned-tf2225941.html#a6171212 > >> Sent from the ActiveMQ - User forum at Nabble.com. > > > > > > >=20 > -- > View this message in context: http://www.nabble.com/Sockets-not- > connecting-...-Invalid-handle-returned-tf2225941.html#a6171774 > Sent from the ActiveMQ - User forum at Nabble.com.