Getting a "No response received" after upgrading to Smack 4.1 during roster creation

hi,

while migrating to Smack 4.1.0, i got the following exception during roster group creation in smack 4.1.0. I am creating a user and creating a roster group. But while roster group creation or adding entry to roster, i got the NoResponseException(see below for full stacktrace). Please find the smack exchange streams and full stack trace below,

04:19:38 PM SENT (0): <stream:stream xmlns=‘jabber:client’ to=‘muthuram6’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ xml:lang=‘en’>

04:19:38 PM RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“muthuram6” id=“97cb8c6b” xml:lang=“en” version=“1.0”>

04:19:38 PM RECV (0): stream:featuresDIGEST-MD5PLAINCRAM-MD5zlib</stream:features>

04:19:38 PM SENT (0): amerchant1vinuu-merchantIndia@gmail.comamerchant1231a0bec140d2a5677b65677dbe8f80a</passw ord>

04:19:38 PM RECV (0):

04:19:38 PM SENT (0):

04:19:38 PM SENT (0): </stream:stream>

04:19:38 PM SENT (1): <stream:stream xmlns=‘jabber:client’ to=‘muthuram6’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ xml:lang=‘en’>

04:19:38 PM RECV (1): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“muthuram6” id=“73f383a9” xml:lang=“en” version=“1.0”>stream:featuresDIGEST-MD5PLAINCRAM-MD5zlib</stream:features>

04:19:38 PM SENT (1): =

04:19:38 PM RECV (1): cmVhbG09Im11dGh1cmFtNiIsbm9uY2U9IlhPaS ttMGVxR0c2UTRjMmZuZUt4Vno5eE0xck96aVlaam1SREkrWDciLHFvcD0iYXV0aCIsY2hhcnNldD11dG YtOCxhbGdvcml0aG09bWQ1LXNlc3M=

04:19:38 PM SENT (1): Y2hhcnNldD11dGYtOCx1c2VybmFtZT0iYW1lcm NoYW50MSIscmVhbG09Im11dGh1cmFtNiIsbm9uY2U9IlhPaSttMGVxR0c2UTRjMmZuZUt4Vno5eE0xck 96aVlaam1SREkrWDciLG5jPTAwMDAwMDAxLGNub25jZT0iRGFWY29UaDhnbU8zdW5neWFOa3hiSWEvUW dTdmE5WDZ6a3JDT2R6RiIsZGlnZXN0LXVyaT0ieG1wcC9tdXRodXJhbTYiLG1heGJ1Zj02NTUzNixyZX Nwb25zZT1mYmI5YTFhNDZmNjhjNjBjYzhiMTAxMjk5OWI1YTE1OSxxb3A9YXV0aA==

04:19:38 PM RECV (1): cnNwYXV0aD04OTgyN2MyY2YwYTg5MGQyYmQ2Mm E1MTZjZWUxMmE4ZQ==

04:19:38 PM SENT (1): <stream:stream xmlns=‘jabber:client’ to=‘muthuram6’ xmlns:stream=‘http://etherx.jabber.org/streams’ version=‘1.0’ id=‘73f383a9’ xml:lang=‘en’>

04:19:38 PM RECV (1): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream=“http://etherx.jabber.org/streams” xmlns=“jabber:client” from=“muthuram6” id=“73f383a9” xml:lang=“en” version=“1.0”>stream:featureszlib</stream:features>

04:19:38 PM SENT (1): resource1< /iq>

04:19:38 PM RECV (1): amerchant1@muthuram6/resource1</j id>

04:19:38 PM SENT (1):

04:19:38 PM RECV (1):

04:19:38 PM User logged (1): amerchant1@muthuram6:5222/resource1

04:19:38 PM XMPPConnection authenticated (1)

04:19:38 PM SENT (1):

04:19:38 PM SENT (1):

04:19:38 PM RECV (1):

04:19:38 PM SENT (1):

04:19:38 PM SENT (1): </stream:stream>

04:19:38 PM XMPPConnection closed (1)

Exception reloading roster

  • org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 300000ms (~300s). Used filter: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=ayvix-13)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (bare): amerchant1@muthuram6, FromMatchesFilter (full): muthuram6)).
    at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackExceptio n.java:106)

at org.jivesoftware.smack.AbstractXMPPConnection$6.run(AbstractXMPPConnection.java :1438)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

at java.util.concurrent.FutureTask.run(FutureTask.java:166)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

at java.lang.Thread.run(Thread.java:722)

My Code snippet:

Roster roster = Roster.getInstanceFor(xmppconnection);

xmppconnection.setPacketReplyTimeout(1000 * 60 * 5);

roster.createGroup(groupName);

xmppconnection.disconnect();

Thanks & Regards,

Dharani

Hmm, this appears to be different from NoResponseException smack 4.1.1 , as we see a response to the request:

04:19:38 PM SENT (1):

04:19:38 PM RECV (1):

which should match the filter: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=ayvix-13)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (bare): amerchant1@muthuram6, FromMatchesFilter (full): muthuram6)).

It appears that you are also trying to say that createGroup() does throw. If so, please show the exception, the full stacktrace and XMPP trace when this happens.

this is the full stacktrace i am getting,

Exception reloading roster

  • org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 300000ms (~300s). Used filter: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=ayvix-13)), : fromFilter (OrFilter: (FromMatchesFilter (full): null, FromMatchesFilter (bare): amerchant1@muthuram6, FromMatchesFilter (full): muthuram6)).
    at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackExceptio n.java:106)

at org.jivesoftware.smack.AbstractXMPPConnection$6.run(AbstractXMPPConnection.java :1438)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

at java.util.concurrent.FutureTask.run(FutureTask.java:166)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201 (ScheduledThreadPoolExecutor.java:178)

at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Schedu ledThreadPoolExecutor.java:292)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

at java.lang.Thread.run(Thread.java:722)

Has this been fixed in any way? I am running into this issue where roster.createEntry times out.

Looked into the debug message console, the reply from the server actually shows up in the raw packets received. But got filtered out before it reaches to the calling function. Thus the following Presence subscribe request is never sent.

It looks like the Roster code hasn’t been touched for quite a while. This might be a bug introduced in the filtering logic before the packet arrives at the Roster code?

It looks the the 4.2-alpha1 changes quite a number of methods signature in the exceptions thrown. Could anybody comment on if there is a chance the alpha1 build has this fix before I take the plunge?

Thanks.

Please follow the instructions found at https://github.com/igniterealtime/Smack/wiki/How-to-ask-for-help-or-report-an-is sue when asking for help.

But got filtered out before it reaches to the calling function.

Could you elaborate on that? What makes you think it’s filtered out? How do you know that?

Well, I just figured out the bug, it is my bug. Apologies.

I had a packet filter trying to catch the replies from the pubsub manager. The filter is not correctly implemented and it consumed all the IQ reply packets.

Maybe the original poster had a similar issue?

Thanks for the prompt reply, anyway.

The filter is not correctly implemented and it consumed all the IQ reply packets.

How did you create a filter that is consuming those replies? I don’t think that this should or is possible. Could you elaborate and/or show me the relevant code?

This was what I did:

class PubsubIQStanzaFilter extends StanzaFilter {

@Override
public boolean accept(Stanza packet) {

return IQ.class.isInstance(packet) && packet.getFrom().contains(“pubsub”);

}

}

This caused the result IQ for createEntry to not reach this line:

connection.createPacketCollectorAndSend(rosterPacket).nextResultOrThrow();

then a timeout error is thrown. Maybe I should have called super.accept first?

It also causes the Roster.reload() to fail, which lead me to the realization that the bug is in my code. As soon as I remove the StanzaLister with this filter, things start to work.

I changed to use a FromMatchFilter like this:

StanzaFilter filter = new FromMatchesFilter(“pubsub.OnePlat5”, true);

Seems to work fine. Appreciate if you let me know of any problems you see.

Maybe I should have called super.accept first?
No, I don’t see how this could cause the other listener to not receive the stanza. What did you do in the listener method?

I changed to use a FromMatchFilter like this:

StanzaFilter filter = new FromMatchesFilter(“pubsub.OnePlat5”, true);

Seems to work fine. Appreciate if you let me know of any problems you see.

The filter seems to be awfully generic, depending on what you really want to receive you may want to wrap it into a AndFilter and ad a constraint for IQs (or whatever else you want to receive).

In the listener method, I look for specific replies that I am interested. One of them is a list of affiliations to a node.

if(stanza.getFrom().contains(“pubsub”)) {

List map = stanza.getExtensions();

Iterator iterator = map.iterator();

while (iterator.hasNext()) {

Object element = iterator.next();

if (element instanceof AffiliationsExtension) {

Iterator affiliationIterator = ((AffiliationsExtension) element).getAffiliations().iterator();

while (affiliationIterator.hasNext()) {

Affiliation affiliation = affiliationIterator.next();

System.out.print(affiliation.getElementName() + ": " + affiliation.getNodeId() + ", " + affiliation.getType() + “\n”);

}

}

}

I’ve changed the filters to:

StanzaFilter filter = new AndFilter(new StanzaTypeFilter(IQ.class), new FromMatchesFilter(“pubsub.OnePlat5”, true));

Are there more documentation on the filters? It looks like the filters such as IQReplyFilter are meant to be used in a different way than filter like StanzaTypeFilter. But most of the google references seem to be out of date.

By the way, really appreciate your providing valuable feedback and guidance.