buddycloud / buddycloud-server-java

The buddycloud server written in Java.
http://buddycloud.com
Apache License 2.0
67 stars 40 forks source link

XMPP conflict after being restarted by upstart #261

Closed abmargb closed 10 years ago

abmargb commented 10 years ago

It seems the buddycloud server was restarted by upstart and it couldn't come up.

2014-11-03 16:17:35,714 [pool-4-thread-1] INFO  org.buddycloud.channelserver.TopicsEngine - Topic component does not handle these packets: '<iq type="get" to="topics.buddycloud.org" from="buddycloud-crawler@buddycloud.org/crawler-9191406970619035344" id="3Sb88-219793"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>'.
2014-11-03 16:19:05,809 [main] INFO  org.buddycloud.channelserver.Main - Starting Buddycloud channel mockup version...
2014-11-03 16:19:05,841 [main] INFO  org.buddycloud.channelserver.utils.configuration.FileLoader - Loaded configuration.properties from working directory.
2014-11-03 16:19:06,076 [main] INFO  org.buddycloud.channelserver.Main - Connecting to '127.0.0.1:5347' and trying to claim address 'buddycloud.org'.
2014-11-03 16:19:06,417 [main] ERROR org.buddycloud.channelserver.Main - Failed during initialization.
org.xmpp.component.ComponentException: conflict
        at org.jivesoftware.whack.ExternalComponent.connect(ExternalComponent.java:209)
        at org.jivesoftware.whack.ExternalComponentManager.addComponent(ExternalComponentManager.java:206)
        at org.buddycloud.channelserver.XmppComponent.run(XmppComponent.java:29)
        at org.buddycloud.channelserver.Main.startComponents(Main.java:33)
        at org.buddycloud.channelserver.Main.main(Main.java:12)
lloydwatkin commented 10 years ago

Yes it seems that prosody (in our case), presumably tigase in yours doesn't immediately realise the connection is gone. When I restart generally I wait a few seconds before restarting. We need to add a retry to smack (or load balance the components to get around the issue).

imaginator commented 10 years ago

I ended up putting a small sleep into the original init file. Smack backing off would be the ideal solution to this.

lloydwatkin commented 10 years ago

See also:

imaginator commented 10 years ago

@Flowdalic: what's the best way to handle this reconnect in Smack? still tweaking: https://github.com/xose/whack/blob/master/src/main/java/org/jivesoftware/whack/ExternalComponent.java#L463 ?

Flowdalic commented 10 years ago

Since it's a resource conflict you are seeing here, how about simply changing the server's policy on resource conflicts to "drop old". Most XMPP servers provide such a setting.

Historically, Smack's ReconnectionManager, if enabled, aborts if there is a StreamError which reason is "conflict". I can comment on why this is the case. It was added with https://github.com/igniterealtime/Smack/commit/4e0397e80ab9741dc565f49011ff0eb19de89f58

Wait a moment: I'm not sure if I miss something, but I don't see where Smack is involved in the stacktrace. It appears you are using whack. Whack and Tinder are two abandoned projects. I would not recommend using them. (I always planned to add support for components to jxmpp or to start a new jxmpp/Smack based XMPP components library, but this is not a high priority for me right now).

imaginator commented 10 years ago

Sorry to drag you into this - I'd just assumed that the channel server was using smack. Oops.

(trying to not be embarrassed)