Projects tigase _server server-core Issues #410
Message: do not preprocess delivery errors (#410)
Closed
Daniele Ricci opened 10 years ago
Due Date
2015-02-20

This patch removes message preprocessing with delivery-error extension.

I'm actually submitting this patch because I'd like to understand exactly how not doing this could lead to duplicate messages.

And if it's that the case, I'd rather receive duplicate messages then lose them forever (but that's of course my point of view).

In my custom Tigase I've already applied this patch and works very well, always ensuring message delivery (I use SM without resume and without AMP, and my client always sends messages to bare JIDs). My client uses the packet id to identify messages, so duplicates are handled and discarded.

I'd like to know what do you think about this approach.

12ec9cc95124164d94af4091a991b0da2f1f32b5.patch

Artur Hefczyc commented 10 years ago

I am assigning this to Andrzej, as he is the author of the code.

Andrzej Wójcik (Tigase) commented 10 years ago

Code responsible for stopping of processing of not delivered messages is there to protect against delivering duplicated messages to other clients connected to same bare jid of user as state in comment in C2SDeliveryErrorProcessor class:

// We should ignore messages sent to bare jid if message contains delivery-error 
// payload and other connection is currently active - this is needed to reduce
// issues related to duplication of messages

as message could be delivered properly to other device of connected user and processing will resend this message to every device.

This only happens for messages sent to bare jid which in your case when SM is used without resumption and messages are sent to bare jid it may lead to message loss, however messages sent to bare jid occur less often than messages sent to full jid in typical XMPP protocol usecase.

I will investigate how to change internal flow of processing of messages in Tigase XMPP Server to be able to properly deliver message sent to bare jid, however I'm against applying provided patch as most XMPP clients do not care to check id of received message to detect duplicates.

Daniele Ricci commented 10 years ago

Yours are all valid points of course, hard to deny.

The problem here is this special case for Kontalk, because it's oriented to mobile devices and accounts are linked to a phone number. This brings a whole set of rules, considerations and behaviours, and some of which are not suited to strict XMPP rules (although they are very flexible, but it always requires some "trick" when a XEP is not available or the protocol extension is not "implementable" as a new XEP).

All of that said: could this be bound to a parameter? Would you accept such a patch if I'd submit it?

Andrzej Wójcik (Tigase) commented 10 years ago

I looked into possibility to make sure that proper connections will get messages but I will need more time to make sure this will work as expected.

Daniele Ricci commented 10 years ago

Thanks Andrzej! I will look forward to study your solution and test it.

Andrzej Wójcik (Tigase) commented 9 years ago

I changed logic of handling delivery-error reported by StreamManagement so now messages which where sent to bare jid will be resent to sessions which where connected after original packet was processed at first. This should fix issue and also do not cause issue with delivery of duplicated messages to other user connections.

Daniele Ricci commented 9 years ago

Thanks for the fix Andrzej, I think it might be a good compromise and probably fix the issue. However, I won't be able to try it before it's released (we are using stable Tigase releases now for Kontalk and these kind of errors are not easy to reproduce locally because they involve a high rate of connection instabilities and that happens only with strange situations like bad mobile network coverage, which can't be reproduced in a controlled TCP/IP environment - at least I don't know how).

Daniele Ricci commented 9 years ago

I see you didn't set a milestone release for this fix. Do you have an estimate?

Daniele Ricci commented 9 years ago
List<Element> delays = packet.getElement().findChildren((Element e) -> e.getName() == "delay" && e.getXMLNS() == "urn:xmpp:delay");

Isn't this a Java 8 feature? Does it mean Tigase has Java 8 requirement? Is it specified somewhere?

wojciech.kapcia@tigase.net commented 9 years ago

Daniele Ricci wrote:

Isn't this a Java 8 feature? Does it mean Tigase has Java 8 requirement? Is it specified somewhere?

As this is for the 7.1.0 which hasn't been released yet it wasn't announced. However please follow #2865 and related commits.

Daniele Ricci commented 9 years ago

Oh I see. Thanks for the heads-up!

Daniele Ricci commented 9 years ago

I'm sorry I can't test this until 7.1.0 release, could you remove the assignee please? I'm getting that email everyday :)

issue 1 of 1
Type
Patch
Priority
Minor
Assignee
RedmineID
2596
Version
tigase-server-7.1.0
Spent time
60h
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#410
Please wait...
Page is in error, reload to recover