powered by Jive Software

Packet collector freeze

Hi,

I am experience an issue while using packet collector to receive the response for a XMPP request. When the sever responds with an error resposne(as per openfire logs) for the request, the response seems to be null. Hence I am throwing an XMPP exception.

PacketCollector collector = connection.createPacketCollector(new PacketIDFilter(myRequest.getPacketID()));

connection.sendPacket(myRequest);

MyPacket myResponse = (MyPacket)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());

collector.cancel();

if (myResponse== null) {

throw new XMPPException(“Server timed out”);

}

if (myResponse.getType() == IQ.Type.ERROR) {

throw new XMPPException(“Error getting your response”, myResponse.getError());

}

After this point smack isnt receving any packet that is coming from openfire. I am puzzled on the behaviour and left with no clue.

Please help me here.

You should run the smack debugger to see what raw packets you are receiving. What you are seeing typically indicates the server did not respond to your request at all, hence a timeout on your call to **nextResult() **leaving you with a null response.

If this happens consistently then there may be a problem with the server responding to this particular request in a timely manner, or your connection has dropped. Since you don’t seem to get any packets after this, I would guess that your connection has dropped.

HINT: You can do this with a single call to

SyncPacketSend.getReply()

Here are few observations from my debugging,

  1. Connection remains connected. This is confirmed by two things,

a. further to collector freeze, xmpp packets sent by my client are reaching openfire.

b. openfire client session shows the connection

  1. From openfire logs the response is sent to my client application. Tested the same scenario with xml debugger I am receving an IQ error as response.

  2. Tried customising the reply timeout to 5000 and 10000 ms. No luck .

Please help me with a hint.