xmppjs / hubot-xmpp

XMPP adapter for Hubot
181 stars 101 forks source link

Hubot instance does not reconnect on restart of Prosody server #87

Open mrijke opened 9 years ago

mrijke commented 9 years ago

When I restart my XMPP server (Prosody), my hubot instance does not reconnect automatically. Instead, the hubot instance keeps trying to ping the server, but does not get a response.

[Wed Aug 05 2015 14:09:04 GMT+0200 (CEST)] DEBUG [sending ping] <iq type="get"><ping xmlns="urn:xmpp:ping"/></iq>
[Wed Aug 05 2015 14:09:34 GMT+0200 (CEST)] DEBUG [sending ping] <iq type="get"><ping xmlns="urn:xmpp:ping"/></iq>

I'm using the following package versions:

    "hubot": "^2.13.2",
    "hubot-xmpp": "^0.1.16"

And Prosody 0.10.

Any thoughts on what could be the issue? My normal clients reconnect fine. If you need further information I'd be happy to debug this more.

markstory commented 9 years ago

No idea, I've never used that xmpp server before. If you want to dig in more, this code handles attempting to reconnect.

ReformedGeek commented 7 years ago

@markstory

I have the same issue with an OpenFire server whenever the server is shut down or restarted. My debug logs show pings with no responses, but the bot never seems to timeout the connection and attempt a reconnect, even after the server comes back up.

[Mon Jul 10 2017 14:27:54 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:28:24 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:28:54 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:29:24 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:29:54 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:30:24 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:30:54 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:31:24 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:31:54 GMT-0400 (EDT)] DEBUG [sending ping] [Mon Jul 10 2017 14:32:24 GMT-0400 (EDT)] DEBUG [sending ping]

Normally the response will be something like unto [Thu Jul 13 2017 20:38:44 GMT-0400 (EDT)] DEBUG [sending ping] [Thu Jul 13 2017 20:38:44 GMT-0400 (EDT)] DEBUG [received iq]

The relevant environment variables are: HUBOT_XMPP_RECONNECT_TRY=2880 HUBOT_XMPP_RECONNECT_WAIT=30000

As seen from the above keepalive logs, I use the default of 30000 ms for the keepalive.

From the code you linked, it would seem that on line 84, you set

@client.connection.socket.setTimeout 0

Could this be the root cause? The lack of response to pings doesn't seem to trigger a reconnect attempt.