Project

General

Profile

nonpriority queue not working

Justin Karneges
Added about 4 years ago

Hi,

I'm using Tigase 5.2.3.

We are using pubsub temporary subscriptions, and when a client sends a presence stanza to our pubsub service and immediately follows it with an iq for subscribing, there is a chance that the pubsub service receives these stanzas out of order. Our pubsub service rejects subscriptions from clients whose presence it doesn't have, and so if the iq is received before presence then the subscription is rejected.

I've tried to fix this with --nonpriority-queue=true and --queue-implementation=tigase.util.NonpriorityQueue, but every once in awhile the stanzas still arrive out of order. I don't know if these options are broken or if there is some other way the stanzas could get reordered. To make sure this is not a problem in the pubsub component, I'm returning 1 for processingInThreads() during my tests.


Replies (2)

Added by Justin Karneges about 4 years ago

It occurs to me that even if I solve this for users on our server, I would not be able to solve this for users coming from remote Tigase servers. Probably I need to make our pubsub service capable of handling these stanzas out of sequence.

I still consider this a bug that should be solved somehow though.

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 4 years ago

As for your 1st question. Setting non-priority queue is not enough to avoid out of order packets. There is one more property you need to set. This is a common threads pool as even with non-prority queue, packets can be reordered during processing by plugins in separate threads pools. So you need a common thread pool for all plugins to avoid this.

Answering your second question. Yes, the approach suggested in your last comment makes more sense for a few other reasons:

  1. As far as I know packets reordering may happen on other server implementations as well, so this is not just a Tigase issue. There was a long thread on discussion list where the problem was explained. Strict ordering requires strict serialization, which greatly affects performance.

  2. You can force Tigase for strict ordering/serialization but at performance cost

  3. It does not solve the problem if you exchange packets with external servers

    (1-2/2)