vanitasvitae / Smack

A modular and portable open source XMPP client library written in Java for Android and Java (SE) VMs
https://igniterealtime.org/projects/smack/
Apache License 2.0
16 stars 3 forks source link

Issue with bootstrapping on Prosody #17

Closed n8fr8 closed 7 years ago

n8fr8 commented 7 years ago

We are seeing this error: https://prosody.im/issues/issue/805

against our home.zom.im server.

Was this resolved? Do we need to upgrade mod_pep?

n8fr8 commented 7 years ago

Actually, I am getting this on many servers. This is from a smack-omemo build from the latest commits in 4.2 branch:

04-05 13:12:49.884 16085-16219/org.awesomeapp.messenger.debug D/SMACK: RECV (0): <iq id='qV7s7-424' type='error' to='nathan@guardianproject.info/ChatSecureZom-d8695179'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq><r xmlns='urn:xmpp:sm:3'/><a h='45' xmlns='urn:xmpp:sm:3'/>
04-05 13:13:35.257 16085-16180/org.awesomeapp.messenger.debug E/ZomXMPP: error init'ng OMEMO: XMPPError: service-unavailable - cancel
                                                                         org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel
                                                                             at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:256)
                                                                             at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:208)
                                                                             at org.jivesoftware.smackx.pubsub.PubSubManager.sendPubsubPacket(PubSubManager.java:500)
                                                                             at org.jivesoftware.smackx.pubsub.PubSubManager.createNode(PubSubManager.java:212)
                                                                             at org.jivesoftware.smackx.pubsub.PubSubManager.createNode(PubSubManager.java:179)
                                                                             at org.jivesoftware.smackx.pubsub.PubSubManager.getOrCreateLeafNode(PubSubManager.java:280)
                                                                             at org.jivesoftware.smackx.omemo.OmemoService.fetchDeviceListNode(OmemoService.java:186)
                                                                             at org.jivesoftware.smackx.omemo.OmemoService.publishDeviceIdIfNeeded(OmemoService.java:256)
                                                                             at org.jivesoftware.smackx.omemo.OmemoService.<init>(OmemoService.java:163)
                                                                             at org.jivesoftware.smackx.omemo.signal.SignalOmemoService.<init>(SignalOmemoService.java:67)
                                                                             at org.awesomeapp.messenger.crypto.omemo.Omemo.<init>(Omemo.java:80)
                                                                             at org.awesomeapp.messenger.crypto.omemo.Omemo.getInstance(Omemo.java:49)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection.initOmemo(XmppConnection.java:1333)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection.do_login(XmppConnection.java:1259)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection.access$1400(XmppConnection.java:177)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection$1.run(XmppConnection.java:1173)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                             at java.lang.Thread.run(Thread.java:761)
04-05 13:14:30.244 16085-16219/org.awesomeapp.messenger.debug D/SMACK: RECV (0): <iq id='qV7s7-477' type='error' to='nathan@guardianproject.info/ChatSecureZom-d8695179'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq><r xmlns='urn:xmpp:sm:3'/>
n8fr8 commented 7 years ago
04-05 13:37:38.043 18924-18971/org.awesomeapp.messenger.debug D/SMACK: RECV (0): <iq id='zja3z-28' type='error' to='nxomemo5.c11b3251@jabber.alenan.org/ChatSecureZom-c7544b11'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>
04-05 13:37:38.061 18924-18960/org.awesomeapp.messenger.debug E/ZomXMPP: error init'ng OMEMO: XMPPError: service-unavailable - cancel
                                                                         org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel
                                                                             at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:256)
                                                                             at org.jivesoftware.smack.StanzaCollector.nextResultOrThrow(StanzaCollector.java:208)
                                                                             at org.jivesoftware.smackx.pubsub.PubSubManager.getNode(PubSubManager.java:240)
                                                                             at org.jivesoftware.smackx.pubsub.PubSubManager.getOrCreateLeafNode(PubSubManager.java:275)
                                                                             at org.jivesoftware.smackx.omemo.OmemoService.fetchDeviceListNode(OmemoService.java:186)
                                                                             at org.jivesoftware.smackx.omemo.OmemoService.publishDeviceIdIfNeeded(OmemoService.java:256)
                                                                             at org.jivesoftware.smackx.omemo.OmemoService.<init>(OmemoService.java:163)
                                                                             at org.jivesoftware.smackx.omemo.signal.SignalOmemoService.<init>(SignalOmemoService.java:67)
                                                                             at org.awesomeapp.messenger.crypto.omemo.Omemo.<init>(Omemo.java:83)
                                                                             at org.awesomeapp.messenger.crypto.omemo.Omemo.getInstance(Omemo.java:50)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection.initOmemo(XmppConnection.java:1333)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection.do_login(XmppConnection.java:1259)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection.access$1400(XmppConnection.java:177)
                                                                             at org.awesomeapp.messenger.plugin.xmpp.XmppConnection$1.run(XmppConnection.java:1173)
                                                                             at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                             at java.util.concurrent.ThreadPoolExecutor$Worker.run
n8fr8 commented 7 years ago

This is on 5222.de which Conversations lists as compliant

SENT (1): <iq to='nxtestfoo.1c007995@5222.de' id='syCPe-102' type='set'><pubsub xmlns='http://jabber.org/protocol/pubsub'><create node='eu.siacs.conversations.axolotl.devicelist'/></pubsub></iq><r xmlns='urn:xmpp:sm:3'/>
04-05 14:09:29.918 32745-1263/org.awesomeapp.messenger.debug D/SMACK: RECV (1): <r xmlns='urn:xmpp:sm:3'/>
04-05 14:09:29.922 32745-1262/org.awesomeapp.messenger.debug D/SMACK: SENT (1): <a xmlns='urn:xmpp:sm:3' h='15'/>
04-05 14:09:30.022 32745-1263/org.awesomeapp.messenger.debug D/SMACK: RECV (1): <iq id='syCPe-102' type='error' to='nxtestfoo.1c007995@5222.de/ChatSecureZom-eb46339a'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq><a h='15' xmlns='urn:xmpp:sm:3'/>
04-05 14:09:30.027 32745-1324/org.awesomeapp.messenger.debug E/ZomXMPP: 0 : unable to send message
                                                                        org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: service-unavailable - cancel
n8fr8 commented 7 years ago

Proper log output here: https://gist.github.com/n8fr8/4fafa6406c00e9981fc89dc5d43ad59d

vanitasvitae commented 7 years ago

As far as I know, this error can be ignored, but maybe @Flowdalic knows more?

n8fr8 commented 7 years ago

Yes, but it is throwing the exception before it completes the setup of OmemoService:

275) at org.jivesoftware.smackx.omemo.OmemoService.fetchDeviceListNode(OmemoService.java:186) at org.jivesoftware.smackx.omemo.OmemoService.publishDeviceIdIfNeeded(OmemoService.java:256) at org.jivesoftware.smackx.omemo.OmemoService.(OmemoService.java:163)

vanitasvitae commented 7 years ago

I'd guess that this is either a bug introduced in smack with https://github.com/igniterealtime/Smack/commit/1e0481b3558509b03aa9c1c691dba17d88ceb9df or a bug on the server, but I assume the first. Have you experienced any effect of this? Eg. are other devices unable to start session because they cant find the devicelist?

n8fr8 commented 7 years ago

The issue is that my instance of OmemoService is null, and the OmemoManager never gets the service instance set, since this throws before then.

What appears to happen is that I can receive keys from others, but can't publish keys to others. I am going to try and catch the exception myself and see if that improves things.

vanitasvitae commented 7 years ago

Ah I see. Hm, I'll see if I can come up with a fix tomorrow. I'm a little busy right now :/ If you find a fix for this - PRs are welcome :)

n8fr8 commented 7 years ago

This isn't a PR, but here is my commit with a quick hack for moving back to your code before "getOrCreateLeafNode" came along and screwed it all up! :) https://github.com/guardianproject/smack-omemo/commit/aa3a2aceb1594d23c333f101046419f067302221

vanitasvitae commented 7 years ago

Then its most likely an issue with smack. Good to know that you could fix it.

vanitasvitae commented 7 years ago

Will be fixed with https://github.com/vanitasvitae/smack-omemo/commit/629710f296a9aed1a5b6fd9e0a4c1b5960c68655 when https://github.com/igniterealtime/Smack/pull/123 gets merged.

vanitasvitae commented 7 years ago

@n8fr8 I made some minor changes to the code. You'll have to add the Security provider on your own now before creating the service. Also after you created the service, you have to call the setup() method that will do the heavy lifting (publishing bundles, device lists etc.).

mimi89999 commented 7 years ago

@n8fr8 Generally, it is good to keep the server up to date. Modules also...

home.zom.im is running Prosody version 0.9.7 on Linux

Latest is 0.9.12

vanitasvitae commented 7 years ago

Fixed with https://github.com/igniterealtime/Smack/pull/123 and https://github.com/vanitasvitae/smack-omemo/commit/9c97233d0ea13d8a2b315e5bd9af0faeaaa3b8f0

mimi89999 commented 7 years ago

@vanitasvitae Thanks 🙂