powered by Jive Software

Is it a Bug?

Today i upgraded from 3.x to 4.0.3 aSmack and found one issue not sure if its a Bug or I am doiing something wrong.

gconfig = new ConnectionConfiguration(SERVER_IP,SERVER_PORT,SERVER_HOST);

gconfig.setSecurityMode(SecurityMode.disabled)

gconfig.setReconnectionAllowed(true);

gconfig.setDebuggerEnabled(true);

SmackConfiguration.setDefaultPacketReplyTimeout(10000);

SmackConfiguration.DEBUG_ENABLED=true;

try {

xmppConnectionHandle = new XMPPTCPConnection(Constants.gconfig);

xmppConnectionHandle.connect();

connectionState = true;

FileLog.b(log_tag, xmppConnectionHandle.isConnected());

}

catch (Exception e) {

FileLog.e(log_tag, e);

connectionState=false;

}

On this code i just changed xmppConnectionHandle = new XMPPConnection(Constants.gconfig); to xmppConnectionHandle = new XMPPTCPConnection(Constants.gconfig); after the migration to 4.0.3

Once after this if i am idle for 60 secs and then i try to check for support registration and try to register this is when i get the no server response … it send the packet to server but it never reaches to the server but isConnected retruns always true ? Any ideas why ?

Previously when its connected it started sending pings to server but now it doesnt send automatically i used pingmanger but it works only if the user logins and is authenticated else it doesnt send.

Is it a bug or i am doing something wrong ?

Thanks

Jeet

Once after this if i am idle for 60 secs and then i try to check for support registration and try to register this is when i get the no server response
Why do you wait 60 seconds before registering an account?

Any ideas why ?
Not with the provided information, sorry.

Previously when its connected it started sending pings to server but now it doesnt send automatically i used pingmanger but it works only if the user logins and is authenticated else it doesnt send.
Most servers don’t respond to pings if the user isn’t authenticated. So this is intended behavior.

Its like this that i am having this delay 60-130 secs to make sure user confrims email address and the details that he entered on his email or on the screen.

It also happens if i don register but try to login .

But if I login quickly all works good .

This is was working propely and did nothave issues before 4.0.3

Also to confirm what i did i created a small code on Java - SMACK - and tried to replicate it … and it worked properly but was getting many repeated errors

Aug 20, 2014 08:55:49 PM org.jivesoftware.smack.XMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection closed with error
java.io.EOFException: no more data available - expected end tag </stream:stream> to close start tag <stream:stream> from line 1, parser stopped on END_TAG seen ...xmlns=\'http://jabber.org/features/iq-register\'/></stream:features>... @1:642
    at org.xmlpull.mxp1.MXParser.fillBuf(MXParser.java:3035)
    at org.xmlpull.mxp1.MXParser.more(MXParser.java:3046)
    at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1144)
    at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
    at org.jivesoftware.smack.tcp.PacketReader.parsePackets(PacketReader.java:279)
    at org.jivesoftware.smack.tcp.PacketReader.access$000(PacketReader.java:47)
    at org.jivesoftware.smack.tcp.PacketReader$1.run(PacketReader.java:81)

But even after this erros i can login … connection is not terminated.
newConnect.java.zip (710 Bytes)

Also i changed back my library to 3.2.2 and i see that as soon as i connect it send empty strings

sthg like this

08-20 15:55:33.946
1237-1261/com.griffin D/SMACK﹕ 03:55:33 PM SENT (-1377796320):
08-20 15:56:03.956
1237-1261/com.griffin D/SMACK﹕ 03:56:03 PM SENT (-1377796320):
08-20 15:56:33.966
1237-1261/com.griffin D/SMACK﹕ 03:56:33 PM SENT (-1377796320):
08-20 15:57:03.976
1237-1261/com.griffin D/SMACK﹕ 03:57:03 PM SENT (-1377796320):
08-20 15:57:33.986
1237-1261/com.griffin D/SMACK﹕ 03:57:33 PM SENT (-1377796320):

And from server this it looks like

19:57:20.504 [debug] Handling Info: <<" ">>
19:57:20.504 [debug] Received XML on stream = <<" ">>
19:57:20.505 [debug] State: {maxrate,1000,38.55030700525688,1408564610498561}, Size=1
M=0.5098269935606654, I=30006.423
19:57:50.519 [debug] Handling Info: <<" ">>
19:57:50.519 [debug] Received XML on stream = <<" ">>
19:57:50.519 [debug] State: {maxrate,1000,19.291816541196177,1408564640505093}, Size=1
M=0.5048699290239483, I=30014.788
19:58:20.526 [debug] Handling Info: <<" ">>
19:58:20.526 [debug] Received XML on stream = <<" ">>
19:58:20.526 [debug] State: {maxrate,1000,9.662566663596232,1408564670519993}, Size=1
M=0.5024273689731592, I=30006.354

This is not happening in latest builds … may this will help .irrespective of if login or not.

Looks like something was changed in 3.3.1 it doesnt work in that either …

After this jars 0.8.1.1/ its not working.

That does look like the server is terminating the connection because of inactivity.

I dont think so because when i chnage the lib to 3.2.2 it works and when i am on 4.0.3 or 3.3.1 it does not . I dont chnage anything on server

Could you then please reword your problem and enable Smack debug and post a stanza trace. Right now I’m having problems following your problem description.

Ok I hope this helps My problem is

  1. when i was using asmack 3.2.2 i was first connecting using xmppConnectionHandle.connect(); once the connection was successful i was able to wait ( have delay ) and then perfrom next steps like xmppConnectionHandle.login() or register a user .

whenever the connection was done i see that asmack sends following sequnces for connecting

**DEBUG 3.2.2 asmack client - server ejabberd 14.07
**

On SmackConfiguration.getVersion());
08-21 05:20:11.716 1614-1614/com.griffin D/AsmackVersion﹕ 3.2.2 on xmppConnectionHandle.connect(); 08-21 05:20:12.066 1614-1637/com.griffin D/SMACK﹕ 05:20:12 AM SENT (-1377776776): <stream:stream to="ec2-78-121-132-5.compute-1.amazonaws.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
08-21 05:20:12.296 1614-1638/com.griffin D/SMACK﹕ 05:20:12 AM RCV  (-1377776776): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='775196724' from='ec2-78-121-132-5.compute-1.amazonaws.com' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'> After the above sequence the smack automatically sends empty streams like below ( during my wait or delay) 1614-1639/com.griffin D/SMACK﹕ 05:22:27 AM SENT (-1377776776):
1614-1639/com.griffin D/SMACK﹕ 05:22:57 AM SENT (-1377776776):
1614-1639/com.griffin D/SMACK﹕ 05:23:27 AM SENT (-1377776776):
1614-1639/com.griffin D/SMACK﹕ 05:37:27 AM SENT (-1377776776): At this point server and client are both connected even after connect was called 5:20 and  i was idle for next 17 mins till 5:37 though server doesnot respond anything ( as you see above only sents and no rcv) Now i invoke xmppConnectionHandle.login() and still i am connected and i get response from the server and user is authenticated
1614-1637/com.griffin D/SMACK﹕ 05:39:35 AM SENT (-1377776776): <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></auth>
1614-1638/com.griffin D/SMACK﹕ 05:39:35 AM RCV  (-1377776776): <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>bm9uY2U9IjY1Njg4Nzc4MiIscW9wPSJhdXRoIixjaGFyc2V0PXV0Zi04LGFsZ29yaXRobT1tZDUtc2Vzcw==</challenge>
1614-1637/com.griffin D/SMACK﹕ 05:39:35 AM SENT (-1377776776): <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9Iis5MTk3NjQyMjQwMDMiLHJlYWxtPSJlYzItNzUtMTAxLTEzMi01LmNvbXB1dGUtMS5hbWF6b25hd3MuY29tIixjbm9uY2U9ImUyNWZiNzdmM2QzM2IwMmUzYzRmN2FmMGQ0NWM5NjQ5ZjFkMjY4YWUyNGEzYWYyNmFlNzNlZjBlOWMyZDJjNmUiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZWMyLTc1LTEwMS0xMzItNS5jb21wdXRlLTEuYW1hem9uYXdzLmNvbSIscmVzcG9uc2U9MmEyYzExYjFiYzBhMjcxNzYzMGI3ZWJlNGNlN2M5NDEsY2hhcnNldD11dGYtOCxub25jZT0iNjU2ODg3NzgyIg==</response>
1614-1638/com.griffin D/SMACK﹕ 05:39:36 AM RCV  (-1377776776): <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>cnNwYXV0aD04ZTA2NDQ2MThhZDg4YTU2ZTVjNTU5MzBiZDZmZDc1MQ==</challenge>
08-21 05:39:36.036    1614-1637/com.griffin D/SMACK﹕ 05:39:36 AM SENT (-1377776776): <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></response>
08-21 05:39:36.246    1614-1638/com.griffin D/SMACK﹕ 05:39:36 AM RCV  (-1377776776): <success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
08-21 05:39:36.896    1614-1614/com.griffin D/griffin:GriffinAccounts﹕ Authenticated user
08-21 05:39:36.896    1614-1637/com.griffin D/SMACK﹕ 05:39:36 AM SENT (-1377776776): <iq id="lO01x-2" type="get"><query xmlns="jabber:iq:roster" ></query></iq>
08-21 05:39:36.906    1614-1637/com.griffin D/SMACK﹕ 05:39:36 AM SENT (-1377776776): <presence id="lO01x-4"></presence>
08-21 05:39:36.916    1614-1637/com.griffin D/SMACK﹕ 05:39:36 AM SENT (-1377776776): <presence id="lO01x-3"><status>Gone fishing</status></presence>
08-21 05:40:27.606    1614-1639/com.griffin D/SMACK﹕ 05:40:27 AM SENT (-1377776776):
08-21 05:40:57.616    1614-1639/com.griffin D/SMACK﹕ 05:40:57 AM SENT (-1377776776): per the timestmps you will see that after my connect method to login method there was delay ~19 mins and i could still authenticate. netstat on android phone is always established during all phases above.
Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp6       0      0 ::ffff:10.0.2.15:36867 ::ffff:78.121.132.5:5222 ESTABLISHED
  1. If upgrade my client asmack to 3.3.1 or 4.0.3 i have to do xmppConnectionHandle.connect() and xmppConnectionHandle.login() or register a user . without a delay else i cannot autheticate or register. see the debug below

DEBUG 3.3.1 or 4.0.3 asmack client - server ejabberd 14.07

On SmackConfiguration.getVersion());
08-21 05:55:19.086 1614-1614/com.griffin D/AsmackVersion﹕ 3.3.1 on xmppConnectionHandle.connect(); 1709-1731/com.griffin D/SMACK﹕ 05:55:19 AM SENT (-1376867064): <stream:stream to="ec2-78-121-132-5.compute-1.amazonaws.com" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0">
1709-1732/com.griffin D/SMACK﹕ 05:55:19 AM RCV  (-1376867064): <?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='486885245' from='ec2-78-121-132-5.compute-1.amazonaws.com' version='1.0' xml:lang='en'><stream:features><starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>PLAIN</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='r0RBB+5aC6S1U+mJ50q7+TjV47E='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features> After the above sequence the smack DOEST NOT automatically sends empty streams like it was in above debug 08-21 06:00:44.826    1709-1731/com.griffin D/SMACK﹕ 06:00:44 AM SENT (-1376867064): <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"></auth>
08-21 06:01:14.896    1709-1731/com.griffin D/SMACK﹕ 06:01:14 AM SENT (-1376867064): <iq id="0EQ53-0" type="get"><query xmlns="jabber:iq:auth"><username>+919764224003</username></query></iq>
08-21 06:01:24.906    1709-1709/com.griffin W/System.err﹕ No response from the server.:
08-21 06:01:24.936    1709-1709/com.griffin W/System.err﹕ at org.jivesoftware.smack.NonSASLAuthentication.authenticate(NonSASLAuthentication.java:73)
08-21 06:01:24.946    1709-1709/com.griffin W/System.err﹕ at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:352)
08-21 06:01:24.956    1709-1709/com.griffin W/System.err﹕ at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:242)
08-21 06:01:24.956    1709-1709/com.griffin W/System.err﹕ at com.griffin.GriffinAccounts.gLogin(GriffinAccounts.java:65) Though the client send the the packet it never reaches the server and so server does not respond netstat on android phone @ 05:55:19 AM soon after connect
Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp6       0      0 ::ffff:10.0.2.15:51097 ::ffff:78.121.132.5:5222 ESTABLISHED netstat on android phone @ 05:56:21 AM 1 min after connect
Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp6       0      0 ::ffff:10.0.2.15:51097 ::ffff:78.121.132.5:5222 CLOSE_WAIT

http://blogs.technet.com/b/janelewis/archive/2010/03/09/explaining-close-wait.as px

Close_wait state is initiated by client …

I hope i could provide you enough details

I think the chnages were done on purpose to remove whitespace pings as part of https://igniterealtime.org/issues/browse/SMACK-412 to implement it with a XEP-0199 ping however this pings work only after the successful authentication .

During this change i guess the socket is getting closed after 1 min

netstat on android phone @ 05:56:21 AM 1 min after connect
Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp6       0      0 ::ffff:10.0.2.15:51097 ::ffff:78.121.132.5:5222 CLOSE_WAIT

Possible, but it seems that the server is closing the connection, not the client. You could try to either

  • change the server settings (if possible)
  • send a XMPP ping manually to prevent the disconnect

How to change XMPP ping manually ?
If its by using Pingmanager then i have already tried it it works only after the login phase and not between connect and login

I have problems between connect and login.

Simply send a ping to the server between connect and login to try avoiding the idle disconnect:

connection.sendPacket(new Ping(connection.getServiceName));

Besides the real solution for your problem would be to query the user for the required information regarding registration and then connect and to the registration. Not connect, query the user, do the registration.

yea this can be a workaround i will try if it works i will have to keep on sending the pings(though server will respond with service un available i am not authenticated yet ) until i perform next actions.

But what i did for now is forked code from your repo and changed the XMPPTCPConnection.java and PacketWriter.java to overcome the problem that i had now it works as i want.

i ran build.bash -b 4.0 -a 19

it gave the jar file.

But i am not able to start debugger It gives following error all the time

Unable to instantiate either Smack debugger class

Can’t initialize the configured debugger!

What wrong am i doiing here during the build ? i tried to modify build.xml but it did not work

Please help

Yep thats true …

Any idea why after the

./build.bash -b 4.0 -a 19

am not able to start debugger It gives following error all the time

Unable to instantiate either Smack debugger class

Can’t initialize the configured debugger!