gan7488 / xmpphp

Automatically exported from code.google.com/p/xmpphp
0 stars 0 forks source link

Timeout on query #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Sent a query or a presence to JID
2. then used processUntil function for getting it and parsing
3. But JID didn't answer

What is the expected output?
empty XML array.

What do you see instead?
empty page.

What version of the product are you using? On what operating system?
latest

Please provide any additional information below.
Tried to fix it, but there are no solution. socket_set_timeout isn't good,
because it terminates connection to jabber server. We need a timeout
function. PHP doesn't have a nice function for checking function for timeout.

Original issue reported on code.google.com by xdersd on 16 Jun 2009 at 3:12

GoogleCodeExporter commented 8 years ago
I have the same problem. I used the following example code.

$conn = new XMPPHP_XMPP('jabber.ulm.ccc.de', 5222, 'user', 'pass', 
'xmpphp-resource',
'server', $printlog=false, $loglevel=XMPPHP_Log::LEVEL_INFO);

        try {
            $conn->connect();
            $conn->processUntil('session_start');
            $conn->presence();
            foreach($this->jidList as $jid){
                $conn->message($jid, 'This is a test message!');
            }

            $conn->disconnect();
        } catch(XMPPHP_Exception $e) {
            die($e->getMessage());
        }

At first I was totally confused (ok ... I'm still confused to be honest) because
there were no error messages. Neither in the Browser, nor in the server logs.

Then I changed $printlog=false to true.
After that it's not an endlessly loading blank page in the browser.
It's iterating the same error message for about 10 to 15 minutes:
1267265902 [INFO]: Connecting to tcp://jabber.ulm.ccc.de:5222 1267265902 
[WARNING]:
Reconnecting (30)... 1267265902 [INFO]: Connecting to 
tcp://jabber.ulm.ccc.de:5222 

I tried it with another server but the result is the same. 

Original comment by pod...@gmx.de on 27 Feb 2010 at 10:21

GoogleCodeExporter commented 8 years ago
Same problem for me

Original comment by men...@gmail.com on 28 Apr 2010 at 5:51

GoogleCodeExporter commented 8 years ago
1272477122 [INFO]: Connecting to tcp://talk.google.com:5222
1272477126 [VERBOSE]: Socket is ready; send it.
1272477126 [VERBOSE]: SENT: <stream:stream to="inamerica.ru"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
version="1.0">
1272477126 [VERBOSE]: Successfully sent 117 bytes.
1272477127 [VERBOSE]: RECV: <stream:stream from="inamerica.ru" 
id="9954EABF13A0013F"
version="1.0" xmlns:stream="http://etherx.jabber.org/streams" 
xmlns="jabber:client">
1272477127 [WARNING]: Reconnecting (30)...
1272477127 [INFO]: Connecting to tcp://talk.google.com:5222
1272477127 [VERBOSE]: Socket is ready; send it.
1272477127 [VERBOSE]: SENT: <stream:stream to="inamerica.ru"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
version="1.0">
1272477127 [VERBOSE]: Successfully sent 117 bytes.
1272477127 [DEBUG]: EVENT: reconnect
1272477127 [VERBOSE]: RECV: 
1272477127 [WARNING]: Reconnecting (30)...
1272477127 [INFO]: Connecting to tcp://talk.google.com:5222
1272477128 [VERBOSE]: Socket is ready; send it.
1272477128 [VERBOSE]: SENT: <stream:stream to="inamerica.ru"
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
version="1.0">
1272477128 [VERBOSE]: Successfully sent 117 bytes.
1272477128 [DEBUG]: EVENT: reconnect
1272477128 [VERBOSE]: RECV: 

Original comment by men...@gmail.com on 28 Apr 2010 at 5:52

GoogleCodeExporter commented 8 years ago
Same problem here... anyone has a clue?

Original comment by m.botanch@gmail.com on 27 May 2010 at 9:04

GoogleCodeExporter commented 8 years ago
same problem as meniam!
running from localhost (apache && PHP 5.3.2-1 )

Original comment by vitotaf...@gmail.com on 1 Jul 2010 at 9:02

GoogleCodeExporter commented 8 years ago
found error in bufferComplete
this is my log

1277996084 [INFO]: Connecting to tcp://talk.google.com:5222
1277996085 [VERBOSE]: Socket is ready; send it.
1277996085 [VERBOSE]: SENT: <stream:stream to="gmail.com" 
xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" 
version="1.0">
1277996085 [VERBOSE]: Successfully sent 114 bytes.
1277996085 [VERBOSE]: RECV: <stream:stream from="gmail.com" 
id="645D53C42AC3E7F9" version="1.0" 
xmlns:stream="http://etherx.jabber.org/streams" 
xmlns="jabber:client"><stream:features><starttls 
xmlns="urn:ietf:params:xml:ns:xmpp-tls"><required/></starttls><mechanisms 
xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>X-GOOGLE-TOKEN</mechanism></
mechanisms></stream:features>

as you can see stream doesn't start with an xml tag
so in bufferComplete function
    if ($start == '?xml' )
fails

i've changed it with
    if ($start == '?xml' || substr($start,-6) == 'stream' )

and now it seems to work 

BUT there's another problem in the _process function when $part is empty (but 
some buffer has been read) and you force a reconnect that is why our script 
reconnect continuously!

Original comment by vitotaf...@gmail.com on 1 Jul 2010 at 3:00

GoogleCodeExporter commented 8 years ago
i've forked the project on github
and solved partially the problem

http://github.com/vitotafuni/xmpphp

Original comment by vitotaf...@gmail.com on 2 Jul 2010 at 7:24

GoogleCodeExporter commented 8 years ago
I have the same problem as menial too.
Could anyone solve this problem? Please give me a hint!

Original comment by toshimin...@gmail.com on 17 Jun 2011 at 7:02