[jitsi-dev] Problem when logging in using branch smack4-2


#1

Hello all,

Is anyone else facing the same problem as I do when using the branch
smack4-2 and trying to connect to any server?

Since the month of January I have been facing the following problem when
trying to connect to any server using the branch smack4-2. In this case I
am trying to connect to my own one. The received packets are:

<?xml version='1.0'?><stream:stream xmlns:stream='
http://etherx.jabber.org/streams' version='1.0' from='example.org'
id='2ceeb114-241f-43d4-981c-3792d16d1465' xml:lang='en'
xmlns='jabber:client'><stream:features><mechanisms
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>SCRAM-SHA-1</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>
<failure
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><malformed-request/><text>Invalid
username.</text></failure>
<presence id='e97Y1-30' type='error'><error
type='cancel'><service-unavailable
xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence>
</stream:stream>

Also, you can see the smack window in the attached file.

Finally, I found that the problem might be related with the smack library
as I am getting this in the console:

2018-02-15 12:26:31.485 SEVERE: [74]
org.jivesoftware.smack.AbstractXMPPConnection.run() Exception in async
packet listener
     [java] java.lang.NullPointerException
     [java] at
java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
     [java] at
java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
     [java] at
net.java.sip.communicator.impl.protocol.jabber.extensions.caps.EntityCapsManager.removeUserCapsNode(EntityCapsManager.java:362)
     [java] at
net.java.sip.communicator.impl.protocol.jabber.extensions.caps.EntityCapsManager$CapsPacketListener.processStanza(EntityCapsManager.java:941)
     [java] at
org.jivesoftware.smack.AbstractXMPPConnection$4.run(AbstractXMPPConnection.java:1198)
     [java] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
     [java] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
     [java] at java.lang.Thread.run(Thread.java:748)

And after checking the code I found that the exception is thrown when using
the "login" method in the LoginByPasswordStrategy.java class.

Any idea or suggestion?

Thanks.


#2

It looks like this happens because the presence packet you receive doesn't have a "from" field. I don't know how we handle this is master. I think the EntityCapsManager doesn't care about presence without "from", so it should be safe to just add a null check in processStanza (line ~900).

Regards,
Boris

···

On 15/02/2018 07:26, Max Chmutov wrote:

Hello all,

Is anyone else facing the same problem as I do when using the branch smack4-2 and trying to connect to any server?

Since the month of January I have been facing the following problem when trying to connect to any server using the branch smack4-2. In this case I am trying to connect to my own one. The received packets are:

<?xml version='1.0'?><stream:stream xmlns:stream='http://etherx.jabber.org/streams' version='1.0' from='example.org <http://example.org>' id='2ceeb114-241f-43d4-981c-3792d16d1465' xml:lang='en' xmlns='jabber:client'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>SCRAM-SHA-1</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms></stream:features>
<failure xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><malformed-request/><text>Invalid username.</text></failure>
<presence id='e97Y1-30' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></presence>
</stream:stream>

Also, you can see the smack window in the attached file.

Finally, I found that the problem might be related with the smack library as I am getting this in the console:

2018-02-15 12:26:31.485 SEVERE: [74] org.jivesoftware.smack.AbstractXMPPConnection.run() Exception in async packet listener
[java] java.lang.NullPointerException
[java] at java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
[java] at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
[java] at net.java.sip.communicator.impl.protocol.jabber.extensions.caps.EntityCapsManager.removeUserCapsNode(EntityCapsManager.java:362)
[java] at net.java.sip.communicator.impl.protocol.jabber.extensions.caps.EntityCapsManager$CapsPacketListener.processStanza(EntityCapsManager.java:941)
[java] at org.jivesoftware.smack.AbstractXMPPConnection$4.run(AbstractXMPPConnection.java:1198)
[java] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[java] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[java] at java.lang.Thread.run(Thread.java:748)

And after checking the code I found that the exception is thrown when using the "login" method in the LoginByPasswordStrategy.java class.

Any idea or suggestion?