Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Battery drain by endlessly repeating ClassCastException: org.jivesoftware.smack.packet.EmptyResultIQ cannot be cast to org.jivesoftware.smackx.disco.packet.DiscoverInfo #911

Open
rfc2822 opened this issue Nov 5, 2019 · 4 comments
Assignees
Labels

Comments

@rfc2822
Copy link

rfc2822 commented Nov 5, 2019

I really like Xabber 2.6.6.644-open (from F-Droid), but unfortunately, I can't use it with my Prosody server (prosody-0.11.2_2 on FreeBSD 11.3-RELEASE-p3) because Xabber is unresponsive, crashes from time to time and consumes a lot of battery even when it's not used. Debug logs show this message a few times per second:

2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ java.lang.ClassCastException: org.jivesoftware.smack.packet.EmptyResultIQ cannot be cast to org.jivesoftware.smackx.disco.packet.DiscoverInfo
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverInfo(Unknown Source:28)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverInfo(Unknown Source:25)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ com.xabber.android.data.extension.capability.CapabilitiesManager.updateClientInfo(Unknown Source:26)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ com.xabber.android.data.extension.capability.CapabilitiesManager$1.run(Unknown Source:6)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ com.xabber.android.data.Application$9.run(Unknown Source:2)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ java.util.concurrent.FutureTask.run(FutureTask.java:266)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
2019-11-04_16-50-17 E/com.xabber.android.data.extension.capability.CapabilitiesManager$1@9c4baa5﹕ java.lang.Thread.run(Thread.java:764)
2019-11-04_16-50-17 D/Smack﹕ SENT (0): <iq to='steam.my.server' id='2RO4y-37528' type='get'><query xmlns='http://jabber.org/protocol/disco#info'></query></iq>
2019-11-04_16-50-17 D/Smack﹕ RECV (0): <r xmlns='urn:xmpp:sm:3'/>
2019-11-04_16-50-17 D/Smack﹕ SENT (0): <a xmlns='urn:xmpp:sm:3' h='19053'/>
2019-11-04_16-50-17 D/Smack﹕ RECV (0): <iq type='result' from='steam.my.server' to='myjid@my.server/mobile' id='2RO4y-37528'/>
2019-11-04_16-50-17 W/com.xabber.android.data.extension.capability.CapabilitiesManager$1@43de62b: java.lang.ClassCastException: org.jivesoftware.smack.packet.EmptyResultIQ cannot be cast to org.jivesoftware.smackx.disco.packet.DiscoverInfo
	at org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverInfo(Unknown Source:28)
	at org.jivesoftware.smackx.disco.ServiceDiscoveryManager.discoverInfo(Unknown Source:25)
	at com.xabber.android.data.extension.capability.CapabilitiesManager.updateClientInfo(Unknown Source:26)
	at com.xabber.android.data.extension.capability.CapabilitiesManager$1.run(Unknown Source:6)
	at com.xabber.android.data.Application$9.run(Unknown Source:2)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
	at java.lang.Thread.run(Thread.java:764)

There's a Steam transport running at steam.my.server which I have made myself (using SleekXMPP). Maybe it behaves somehow incorrect. However, I think it shouldn't cause such problems for Xabber – it it doesn't understand something, it should ignore it.

Can you imagine where the problem comes from and what I can do about it? Can I somehow assist in fixing that? Meanwhile, I will investigate on the transport/server side, but I think the client should ignore the problem, too (if there even is one).

@rfc2822
Copy link
Author

rfc2822 commented Nov 5, 2019

I guess it was caused by this code on server side:

    def get_info(self, jid=None, node=None, local=None, cached=None, **kwargs):
        if (jid.bare.endswith("@%s" % self.gateway_jid)):
            info = DiscoInfo()
            info.add_feature('http://jabber.org/protocol/chatstates')
            return info

which needs to be:

    def get_info(self, jid=None, node=None, local=None, cached=None, **kwargs):
        info = DiscoInfo()
        if (jid.bare.endswith("@%s" % self.gateway_jid)):
            info.add_feature('http://jabber.org/protocol/chatstates')
        return info

However, Xabber could maybe be improved so that it doesn't behave strange under such conditions.

@mdosch
Copy link

mdosch commented Nov 6, 2019

There's a Steam transport running at steam.my.server which I have made myself (using SleekXMPP).

That sounds interesting, did you publish it?

@rfc2822
Copy link
Author

rfc2822 commented Nov 6, 2019

That sounds interesting, did you publish it?

Yes, you can find it here: https://gitlab.com/rfc2822/xmpp-steam. It's for personal use and not very polished, but it works fine a for a few users (one Steam worker thread per user) on my server and supports 2FA (SteamGuard).

@andrewnenakhov
Copy link
Member

@popovvitaly take a look pls.

@rfc2822 can you make us an account on your server? if yes, email login/pass on info@xabber.com
also, maybe tell us your Steam username to check how this chat works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants