Timeout on resource binding feature when no sid or wrapped objects empty

Issue #99 invalid
Former user created an issue

I'm running the API towards multiple XMPP backends and most seem to work. I'm however having some issues with Cisco's XMPP server.

Once the following request is sent to the BOSH interface: <body xmlns="http://jabber.org/protocol/httpbind" from="xx@xx.xx" rid="2227623713454810" sid="36271BFE0" to="xx.xx" xml:lang="en-GB" xmlns:xmpp="urn:xmpp:xbosh" xmpp:restart="true"></body>

And the following response is received: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>

It eventually will result in following exception "Timeout while waiting on advertised authentication mechanisms." because the response does not seem to get processed because it does not contain a sid or wrapped objects (see unpackBody method in BoshConnection.java).

P.s. Thanks for an awesome API :)!

Comments (9)

  1. Christian Schudt repo owner

    Actually what should happen then, is that a new (empty) BOSH request should be sent immediately, which would then wait for the next server response (which hopefully is sent immediately by the server).

    Can you verify that?

  2. Peter Meyer Nielsen

    Thanks for the quick reply!

    The following seems to be going in and out:

    IN : <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" rid="2809238599010451" sid="F15CECA2E"></body>
    IN : <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" rid="2809238599010452" sid="F15CECA2E"></body>
    

    and then eventually it results in the "Timeout while waiting on advertised authentication mechanisms." exception.

    If i'm looking at Cisco's javascript API the behaviour is a bit different:

    IN : <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>
    OUT : <body xmlns="http://jabber.org/protocol/httpbind" sid="1032D0AE4C" rid="3660752923"><iq xmlns="jabber:client" type="set" id="x3x0qvJ6kvbO2ePxZEkKE3ZtWpI="><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>jqchat</resource></bind></iq></body>
    

    It seems the IQ request for bind is never sent with the Babbler API.

  3. Christian Schudt repo owner

    Do you have the full communication? Maybe the server never advertised resource binding. The error message also implies, that there are no SASL mechanisms, which should be negotiated before resource binding.

  4. Peter Meyer Nielsen

    Cisco API:

    OUT: <body xmlns="http://jabber.org/protocol/httpbind" xml:lang="da" xmlns:xmpp="urn:xmpp:xbosh" hold="1" ver="1.9" to="xx.xx" wait="30" xmpp:version="1.0" from="xx@xx.xx" rid="1500662241"/>
    IN: <body authid='1114614242' inactivity='60' polling='5' requests='2' secure='true' sid='1114614242' ver='1.8' wait='30' xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>CISCO-VTG-TOKEN</mechanism><hostname xmlns='urn:xmpp:domain-based-name:0'>10.10.10.10</hostname></mechanisms></stream:features></body>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" sid="1114614242" rid="1500662242"><auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">bm9wZSwgeW91J3JlIG5vdCBnZXR0aW5nIHRoZSByZWFsIG9uZSE=</auth></body>
    IN: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" sid="1114614242" xml:lang="da" xmlns:xmpp="urn:xmpp:xbosh" xmpp:restart="true" to="xx.xx" rid="1500662243"/>
    IN: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" sid="1114614242" rid="1500662244"><iq xmlns="jabber:client" type="set" id="m6RADTXT2XhM4DhTJ62aRHZC1Uo="><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>jqchat</resource></bind></iq></body>
    IN: <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><iq id='m6RADTXT2XhM4DhTJ62aRHZC1Uo=' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>xx@xx.xx/jqchat</jid></bind></iq></body>
    

    Babbler API:

    OUT: <body xmlns="http://jabber.org/protocol/httpbind" ack="1" from="xx@xx.xx" hold="1" rid="2809238599010448" to="xx.xx" ver="1.11" wait="60" xml:lang="en-GB" xmlns:xmpp="urn:xmpp:xbosh" xmpp:version="1.0"></body>
    IN: <body authid='F15CECA2E' inactivity='60' polling='5' requests='2' secure='true' sid='F15CECA2E' ver='1.8' wait='30' xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>CISCO-VTG-TOKEN</mechanism><hostname xmlns='urn:xmpp:domain-based-name:0'>10.10.10.10</hostname></mechanisms></stream:features></body>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" rid="2809238599010449" sid="F15CECA2E"><auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">bm9wZSwgeW91J3JlIG5vdCBnZXR0aW5nIHRoZSByZWFsIG9uZSE=</auth></body>
    IN : <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'><success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/></body>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" from="xx@xx.xx" rid="2809238599010450" sid="F15CECA2E" to="xx.xx" xml:lang="en-GB" xmlns:xmpp="urn:xmpp:xbosh" xmpp:restart="true"></body>
    IN : <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" rid="2809238599010451" sid="F15CECA2E"></body>
    IN : <body xmlns='http://jabber.org/protocol/httpbind' xmlns:stream='http://etherx.jabber.org/streams'/>
    OUT: <body xmlns="http://jabber.org/protocol/httpbind" rid="2809238599010452" sid="F15CECA2E"></body>
    
  5. Christian Schudt repo owner

    The issue is probably, that the server never advertises support for Resource Binding. After the client sends the restart after successful authentication, the server should ("MUST") respond with the bind feature, like here in Example 9.:

    https://xmpp.org/extensions/xep-0206.html#preconditions-sasl

    <body xmlns='http://jabber.org/protocol/httpbind'
          xmlns:stream='http://etherx.jabber.org/streams'>
      <stream:features>
        <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
      </stream:features>
    </body>
    

    but it doesn't. Therefore the client waits for the server until the timeout.

    The only thing I am wondering about is that your error message says: "Timeout while waiting on advertised authentication mechanisms." because authentication is advertised and even successful in the log above. This error message is thrown in the connect() method, but you're already in the login() method apparently. The expected error message would be "Timeout while waiting on resource binding feature.".

  6. Peter Meyer Nielsen

    Ah, I believe I've managed to take the exception message from somewhere else, the message that I'm getting is in fact "Timeout while waiting on resource binding feature.". So I'm guessing everything points in the direction of Cisco not following the protocol.

  7. Christian Schudt repo owner

    Yes, my opinion is that Cisco server violates the protocol, because it doesn't advertise the

    <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
    

    feature after authentication, which is however required by the protocol.

    Babbler API could theoretically log a warning instead of throwing an exception and try to resource bind "into the dark" even if no support was advertised, but you (client) have to wait for the timeout then, which is still not nice. It's because theoretically other features could be advertised and negotiated before resource binding.

    The best solution would be if you could update the server to a newer version and hope it works then or talk to server developers (e.g. file a bug).

  8. Log in to comment