Projects tigase _server server-core Issues #699
Lost messages using BOSH if clients loses connection (#699)
Closed
Nicola Moretti opened 8 years ago
Due Date
2016-09-20

Hi, I'm having this edge case while connecting to the server using BOSH:

  • client loses connection, but tigase recognize disconnection only after timeout (set to 30 seconds)

  • if during this period a message is sent to the client, the message is lost.

I'm using XEP-0184 (message receipts) and I expect the message is put in offline storage, so it is delivered again when client reconnects.

Clientside, I'm using StropheJS (http://strophe.im/strophejs/).

Is it normal that tigase considers the client still connected during that period? And that the message is lost?

Example of message set to the client

<message to='xxx@xmpp.int4.fb.com/Mobile' from='backend@xmpp.int4.fb.com/Server-10' id='083df76b-e6c9-43b0-a397-37cf7abe0497.1'><subject>lorem ipsum</subject><body>lorem ipsum</body><request xmlns='urn:xmpp:receipts'/><amp xmlns="http://jabber.org/protocol/amp"><rule action="drop" condition="expire-at" value="2016-07-29T10:36:27Z"/></amp></message>

Our current Tigase server is: tigase-issue #7.1.0-SNAPSHOT-b4193

NB: without Bosh everything works as usual.

Thanks in advance

Andrzej Wójcik (Tigase) commented 8 years ago

Tigase XMPP Server assumes client connection is active during BOSH timeout (default 30s) as there is no way for server to detect that connection is lost. If there is at least one TCP BOSH connection established between client and server (and not broken yet - at least server is not aware of the fact that connection is broken) packet/stanza is written to this connection IO buffer (socket buffer) and on OS level it should be send to client. If during sending of data connection is broken we are not aware which packets were really delivered and which weren't.

To be able to detect which packets were delivered successfully Stream Management protocol extension was developed and implemented in Tigase XMPP Server, but it works only for C2S connections (client to server using direct XMPP protocol) or with XMPP over WebSocket connections. With this protocol clients confirm that packets were delivered and if connection was broken and some packets are still not marked as delivered they are routed to offline store.

Currently BOSH protocol is still used but as WebSocket offers better performance and better usability, I would suggest to switch from BOSH to WebSocket protocol if possible.

If this is not possible then other solution would be to reconfigure Watchdog for BOSH connection which will force it to check if connection is valid more often. For informations about configuration of watchdog please look at http://docs.tigase.org/tigase-server/snapshot/Administration_Guide/html/#watchdog

Nicola Moretti commented 8 years ago

Thanks for your kind and fast reply. We tried to switch to WebSocket.

Anyway when we try to enable Stream Management

<enable xmlns='urn:xmpp:sm:3' resume='false'/>

Tigase replies

<enable xmlns="urn:xmpp:sm:3" type="error" to="testnicola@push100-2.xmpp.int4.fb.com/Mobile"><error type="cancel" code="501"><feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/><text xml:lang="en" xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Feature not supported yet.</text></error></enable>

Is there any particular setting we need to check?

Stream management works fine for direct xmpp connections (c2s/processors[s]=urn:xmpp:sm:3).

Thanks in advance.

Andrzej Wójcik (Tigase) commented 8 years ago

Following line enables Stream Management for C2S connections:

c2s/processors[s]=urn:xmpp:sm:3

To enable StreamManagement for WebSocket connections you need to add following line:

ws2s/processors[s]=urn:xmpp:sm:3
wojciech.kapcia@tigase.net commented 8 years ago

Closing due to inactivity.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
4382
Version
tigase-server-7.1.0
Spent time
3h 45m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#699
Please wait...
Page is in error, reload to recover