Hi Anatoly, Thanks for this... On 8/28/07, Anatoly Gutnick <anatolyg@xxxxxxxxx> wrote: > > Hello Matthew, > > I compiled gloox from. svn \gloox\branches\work\mw\bosh on Windows XP > using Visual Studio 2005. > > 1) I got 2 small compilation errors > > error C2065: 'uint' : undeclared identifier > time undeclared identifier (missed #include <time.h> ) > > 2) Starting OpenFire Server version 3.3.2 on Windows > Settings configured: Clients can connect to this server using HTTP > binding. Port 18080 > > 3) Start test application based on bosh_example.cpp > > Get Debug error! (See picture attached) > > After output line: 1188296140: Received XML: <iq type='result' id='uid1' > from='ws-anatoly'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq> > > > Run-Time Check Failure #Stack aroung the variable "buf" was corrupted > > Here is a Stack: > > c:\bugs\gloox\branches\work\mw\bosh\src\sha.cpp > const std::string SHA::hex() function > > ntdll.dll!7c901230() > [Frames below may be incorrect and/or missing, no symbols loaded for > ntdll.dll] > gloox.dll!failwithmessage(void * retaddr=0x1023f2a1, int crttype=1, int > errnum=2, const char * msg=0x0012c754) C++ > gloox.dll!_RTC_StackFailure(void * retaddr=0x1023f2a1, const char * > varname=0x1023f2d8) C++ > gloox.dll!_RTC_CheckStackVars(void * frame=0x00000000, _RTC_framedesc * > v=0x00000000) C++ > > gloox.dll!gloox::SHA::hex () Line 64 C++ > gloox.dll!gloox::NonSaslAuth::handleIqID(gloox::Stanza * > stanza=0x003ac218, int context=0) Line 96 C++ > gloox.dll!gloox::ClientBase::notifyIqHandlers(gloox::Stanza * > stanza=0x003ac218) Line 1134 C++ > gloox.dll!gloox::ClientBase::handleTag(gloox::Tag * tag=0x003ab7a0) > Line 224 C++ > gloox.dll!gloox::Parser::streamEvent(gloox::Tag * tag=0x003ab7a0) Line > 430 C++ > gloox.dll!gloox::Parser::closeTag() Line 397 C++ > gloox.dll!gloox::Parser::feed(const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > & > data="<iq type='result' id='uid1' from='ws-anatoly'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq>") > Line 183 C++ > gloox.dll!gloox::ClientBase::parse(const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > & > data="<iq type='result' id='uid1' from='ws-anatoly'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq>") > Line 359 C++ > gloox.dll!gloox::ClientBase::handleReceivedData(const > gloox::ConnectionBase * __formal=0x003a96a0, const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > & > data="<iq type='result' id='uid1' from='ws-anatoly'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq>") > Line 317 C++ > gloox.dll!gloox::ConnectionBOSH::handleTag(gloox::Tag * tag=0x003ab608) > Line 726 C++ > gloox.dll!gloox::Parser::streamEvent(gloox::Tag * tag=0x003ab608) Line > 430 C++ > gloox.dll!gloox::Parser::closeTag() Line 397 C++ > gloox.dll!gloox::Parser::feed(const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > & > data="<body xmlns='http://jabber.org/protocol/httpbind' > <http://jabber.org/protocol/httpbind%27>><iq type="result" id="uid1" > from="ws-anatoly"><query > xmlns="jabber:iq:auth"><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq></body>") > Line 183 C++ > gloox.dll!gloox::ConnectionBOSH::handleXMLData(const > gloox::ConnectionBase * connection=0x003a9160, const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > & > data="<body xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid1" from="ws-anatoly"><query > xmlns="jabber:iq:auth"><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq></body>") > Line 598 C++ > gloox.dll!gloox::ConnectionBOSH::handleReceivedData(const > gloox::ConnectionBase * connection=0x003a9160, const > std::basic_string<char,std::char_traits<char>,std::allocator<char> > & > data="HTTP/1.1 200 OK > Content-Type: text/xml; charset=utf-8 > Content-Length: 238 > Server: Jetty(6.1.x) > > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid1" from="ws-anatoly"><query > xmlns="jabber:iq:auth"><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq></body>") > Line 553 C++ > gloox.dll!gloox::ConnectionTCPClient::recv(int timeout=20) Line 163 C++ > gloox.dll!gloox::ConnectionBOSH::recv(int timeout=20) Line 222 C++ > gloox.dll!gloox::ClientBase::recv(int timeout=20) Line 150 C++ > TestBosh.exe!MessageTest::start() Line 76 C++ > TestBosh.exe!main(int __formal=1, int __formal=1) Line 185 C++ > TestBosh.exe!__tmainCRTStartup() Line 597 C > TestBosh.exe!mainCRTStartup() Line 414 C > kernel32.dll!7c816fd7 () > Odd, and I haven't had this happen before. Perhaps Jakob or someone else will know more than I do. I'll take a look all the same. Here full output after i press ignore: > > > > Added initial connection to connection pool > Connections in pool: 0 > Connections in pool: 1 > 1188296140: BOSH: bosh initiating connection to server > 1188296140: log: level: 0, area: 32, connecting to ws-anatoly ( > 192.168.50.36:18080) > 1188296140: BOSH: bosh connection request sent > Request sent on 003A9160 (POST /http-bind/ HTTP/1.1 > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 260 > > <body content='text/xml; charset=utf-8' hold='2' rid='1728679513' ver='1.6' > wait='30' ack='0' secure='false' route='xmpp:ws-anatoly:5222' xml:lang='en' > xmpp:version=' 1.0' xmlns='http://jabber.org/protocol/httpbind' > xmlns:xmpp='urn:xmpp:xbosh' to='ws-anatoly'/> > ) > 1188296140: Incrementing m_openRequests to 1 (connections: 1) > Response length is 534 but I think it is at least 534 > Decrementing m_openRequests to 0 > > -----------FULL RESPONSE BUFFER--------------- > <body xmlns="http://jabber.org/protocol/httpbind" > xmlns:stream="http://etherx.jabber.org/streams" > authid="aceb1e8" sid="aceb1e8" secure="true" requests="2" inactivity="30" > polling="5" wait="30" ver="1.6 "><stream:features><mechanisms > xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms><compression > xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind<http://jabber.org/features/compress%22%3E%3Cmethod%3Ezlib%3C/method%3E%3C/compression%3E%3Cbind>xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session > xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features></body> > ---------------END------------- > On connection 003A9160 1188296140: BOSH: bosh received XML: > <body xmlns="http://jabber.org/protocol/httpbind" xmlns:stream=" > http://etherx.jabber.org/streams" authid="aceb1e8" sid="aceb1e8" > secure="true" requests="2" inactivity="30" polling="5" wait="30" ver=" > 1.6"><stream:features><mechanisms > xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism></mechanisms><compression > xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><bind<http://jabber.org/features/compress%22%3E%3Cmethod%3Ezlib%3C/method%3E%3C/compression%3E%3Cbind>xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session > xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features></body> > > 1188296140: BOSH: bosh parameter 'polling' now set to 5 seconds > > Told to send: <?xml version='1.0' ?><stream:stream to='ws-anatoly' > xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams ' > xml:lang='en' version='1.0'> > 1188296140: BOSH: initial <stream:stream> dropped > 1188296140: Sent XML: <?xml version='1.0' ?><stream:stream to='ws-anatoly' > xmlns='jabber:client' xmlns:stream=' http://etherx.jabber.org/streams' > xml:lang='en' version='1.0'> > 1188296140: Received XML: <stream:stream > xmlns:stream='http://etherx.jabber.org/streams' > xmlns='jabber:client' version='1.0' from='ws-anatoly' id='aceb1e8' > xml:lang='en'/> > 1188296140: Received XML: <stream:features><mechanisms > xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanisms><compression > xmlns=' > http://jabber.org/features/compress'<http://jabber.org/features/compress%27>><method>zlib</method></compression><bind > xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session > xmlns='urn:ietf:params:xml:ns:xmpp-session'/></stream:features> > > Told to send: <iq to='ws-anatoly' id='uid1' type='get'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username></query></iq> > > Request sent on 003A9160 (POST /http-bind/ HTTP/1.1 > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 233 > > <body rid='1728679514' sid='aceb1e8' xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > to='ws-anatoly' id='uid1' type='get'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username></query></iq></body> > > ) > 1188296140: Incrementing m_openRequests to 1 (connections: 1) > 1188296140: Sent XML: <iq to='ws-anatoly' id='uid1' type='get'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username></query></iq> > > > -----------FULL RESPONSE BUFFER (after handling)--------------- > > ---------------END------------- > Response length is 238 but I think it is at least 238 > Decrementing m_openRequests to 0 > > -----------FULL RESPONSE BUFFER--------------- > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid1" from="ws-anatoly"><query > xmlns="jabber:iq:auth"><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq></body> > > ---------------END------------- > On connection 003A9160 1188296140: BOSH: bosh received XML: > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid1" from="ws-anatoly"><query > xmlns="jabber:iq:auth"><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq></body> > > > 1188296140: Received XML: <iq type='result' id='uid1' > from='ws-anatoly'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><password/><digest/><resource/></query></iq> > > > Told to send: <iq id='uid2' type='set'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><resource>bosh</resource><digest>86eccf459972ca3aeb77c697d602897d1690aa6a</digest></query></iq> > > Request sent on 003A9160 (POST /http-bind/ HTTP/1.1 > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 299 > > <body rid='1728679515' sid='aceb1e8' xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > id='uid2' type='set'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><resource>bosh</resource><digest>86eccf459972ca3aeb77c697d602897d1690aa6a</digest></query></iq></body> > > ) > 1188296142: Incrementing m_openRequests to 1 (connections: 1) > 1188296142: Sent XML: <iq id='uid2' type='set'><query > xmlns='jabber:iq:auth'><username>b099e04fec75b7700ff3f44d5d2931767c2f98cd</username><resource>bosh</resource><digest>86eccf459972ca3aeb77c697d602897d1690aa6a</digest></query></iq> > > > -----------FULL RESPONSE BUFFER (after handling)--------------- > > ---------------END------------- > Response length is 148 but I think it is at least 148 > Decrementing m_openRequests to 0 > > -----------FULL RESPONSE BUFFER--------------- > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid2" to=" > b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"/></body<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22/%3E%3C/body> > > > ---------------END------------- > On connection 003A9160 1188296142: BOSH: bosh received XML: > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid2" > to="b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"/></body<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22/%3E%3C/body> > > > > 1188296142: Received XML: <iq type='result' id='uid2' > to='b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh'/ > <to=%27b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%27/>> > > Told to send: <iq id='uid3' type='get'><query > xmlns='jabber:iq:private'><roster xmlns='roster:delimiter'/></query></iq> > Request sent on 003A9160 (POST /http-bind/ HTTP/1.1 > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 193 > > <body rid='1728679516' sid='aceb1e8' xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > id='uid3' type='get'><query xmlns='jabber:iq:private'><roster > xmlns='roster:delimiter'/></query></iq></body> > ) > 1188296142: Incrementing m_openRequests to 1 (connections: 1) > 1188296142: Sent XML: <iq id='uid3' type='get'><query > xmlns='jabber:iq:private'><roster xmlns='roster:delimiter'/></query></iq> > > Told to send: <iq type='get' id='uid4'><query > xmlns='jabber:iq:roster'/></iq> > Request sent on 003A9160 (POST /http-bind/ HTTP/1.1 > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 151 > > <body rid='1728679517' sid='aceb1e8' xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type='get' id='uid4'><query xmlns='jabber:iq:roster'/></iq></body> > ) > 1188296142: Incrementing m_openRequests to 2 (connections: 1) > 1188296142: Sent XML: <iq type='get' id='uid4'><query > xmlns='jabber:iq:roster'/></iq> > > -----------FULL RESPONSE BUFFER (after handling)--------------- > > ---------------END------------- > Response length is 513 but I think it is at least 227 > Decrementing m_openRequests to 1 > > -----------FULL RESPONSE BUFFER--------------- > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid3" to=" > b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"><query<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22%3E%3Cquery>xmlns="jabber:iq:private"><roster > xmlns="roster:delimiter"/></query></iq></body>HTTP/1.1 200 OK > Content-Type: text/xml; charset=utf-8 > Content-Length: 185 > Server: Jetty(6.1.x) > > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid4" > to="b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"><query<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22%3E%3Cquery>xmlns="jabber:iq:roster"/></iq></body> > ---------------END------------- > On connection 003A9160 1188296142: BOSH: bosh received XML: > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid3" > to="b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"><query<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22%3E%3Cquery>xmlns="jabber:iq:private"><roster > xmlns="roster:delimiter"/></query></iq></body> > > 1188296142: Received XML: <iq type='result' id='uid3' > to='b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh'><query > > <to=%27b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%27%3E%3Cquery>xmlns='jabber:iq:private'><roster > xmlns='roster:delimiter'/></query></iq> > > -----------FULL RESPONSE BUFFER (after handling)--------------- > HTTP/1.1 200 OK > Content-Type: text/xml; charset=utf-8 > Content-Length: 185 > Server: Jetty(6.1.x) > > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid4" > to="b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"><query<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22%3E%3Cquery>xmlns="jabber:iq:roster"/></iq></body> > ---------------END------------- > Response length is 185 but I think it is at least 185 > Decrementing m_openRequests to 0 > > -----------FULL RESPONSE BUFFER--------------- > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid4" to=" > b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"><query<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22%3E%3Cquery>xmlns="jabber:iq:roster"/></iq></body> > ---------------END------------- > On connection 003A9160 1188296142: BOSH: bosh received XML: > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><iq > type="result" id="uid4" to=" > b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh"><query<b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%22%3E%3Cquery>xmlns="jabber:iq:roster"/></iq></body> > > 1188296142: Received XML: <iq type='result' id='uid4' > to='b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh'><query > > <to=%27b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly/bosh%27%3E%3Cquery>xmlns='jabber:iq:roster'/></iq> > > Told to send: <presence><priority>0</priority></presence> > Request sent on 003A9160 (POST /http-bind/ HTTP/1.1 > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 131 > > <body rid='1728679518' sid='aceb1e8' xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><presence><priority>0</priority></presence></body> > > ) > 1188296142: Incrementing m_openRequests to 1 (connections: 1) > 1188296142: Sent XML: <presence><priority>0</priority></presence> > connected!!! > > -----------FULL RESPONSE BUFFER (after handling)--------------- > > ---------------END------------- > Response length is 171 but I think it is at least 171 > Decrementing m_openRequests to 0 > > -----------FULL RESPONSE BUFFER--------------- > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><presence > from=" supporter7@ws-anatoly" to=" > b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly" > type="subscribe"/></body> > ---------------END------------- > On connection 003A9160 1188296142: BOSH: bosh received XML: > <body > xmlns='http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27>><presence > from=" supporter7@ws-anatoly" to=" > b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly" > type="subscribe"/></body> > > 1188296142: Received XML: <presence > from='supporter7@ws-anatoly'<from=%27supporter7@ws-anatoly%27> > to='b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly' > <to=%27b099e04fec75b7700ff3f44d5d2931767c2f98cd@ws-anatoly%27>type='subscribe'/> > > -----------FULL RESPONSE BUFFER (after handling)--------------- > > ---------------END------------- > 1188296172: BOSH: connection closed - falling back to HTTP/1.0 connection > method > A TCP connection 003A9160 was disconnected (reason: 3). > Error 3 occured during recv() 1 > 1188296172: BOSH: Sending empty request (or there is data in the send > buffer) > > >>>>> 1188296172 seconds since last empty request <<<<< > 1188296172: BOSH: sending empty request > Restoring a connection whose status is 2 > Request sent on 003A9160 (POST /http-bind/ HTTP/1.0 > Connection: close > Host: ws-anatoly:5222 > Content-Type: text/xml; charset=utf-8 > Content-Length: 88 > > <body rid='1728679519' sid='aceb1e8' xmlns=' > http://jabber.org/protocol/httpbind'<http://jabber.org/protocol/httpbind%27> > ></body> > ) > 1188296172: Incrementing m_openRequests to 1 (connections: 1) > Error 18 occured during recv() 1 > 1188296172: BOSH: Sending empty request (or there is data in the send > buffer) > 1188296172: BOSH: too little time between requests, adding to send buffer > 1188296172: BOSH: No available connections open > ce: 18 > Press any key to continue . > I can see what has happened here. The server is disconnecting the client after 30 seconds because it has not made a request within the timeout period. I know I fixed this problem once already, so I'll see if I can reproduce this. Many thanks, Matthew.