Projects tigase _server tigase-mix Issues #27
MIX-MUC message duplication (#27)
Closed
wojciech.kapcia@tigase.net opened 4 years ago

Sending single message to MIX (either from MIX capable or MUC client like Psi) causes 3 messages to appear:

<message id="b14f47e7-9dcf-442c-a8ac-3c03664bacff" from="test@mix.tigase.im/70c32889291698a6c6e98800892e7979763e1840" type="groupchat" to="wojtek@tigase.im">
<origin-id xmlns="urn:xmpp:sid:0" id="87D35E1E-96BD-4D20-8929-1046107592CB"/>
<body>from beagle</body>
<request xmlns="urn:xmpp:receipts"/>
<mix xmlns="urn:xmpp:mix:core:1">
<nick>Wojtek</nick>
<jid>wojtek@tigase.im</jid>
</mix>
<stanza-id xmlns="urn:xmpp:sid:0" id="b14f47e7-9dcf-442c-a8ac-3c03664bacff" by="test@mix.tigase.im"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="628dc195-0040-438d-a6a4-80a2726054bf" by="wojtek@tigase.im"/>
</message>

<message id="b14f47e7-9dcf-442c-a8ac-3c03664bacff" from="test@mix.tigase.im/Wojtek" type="groupchat" to="wojtek@tigase.im/firefly/psi+/green">
<origin-id xmlns="urn:xmpp:sid:0" id="87D35E1E-96BD-4D20-8929-1046107592CB"/>
<body>from beagle</body>
<request xmlns="urn:xmpp:receipts"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="b14f47e7-9dcf-442c-a8ac-3c03664bacff" by="test@mix.tigase.im"/>
</message>

<message id="b14f47e7-9dcf-442c-a8ac-3c03664bacff" from="test@mix.tigase.im/Wojtek" type="groupchat" to="wojtek@tigase.im/firefly/psi+/green">
<origin-id xmlns="urn:xmpp:sid:0" id="87D35E1E-96BD-4D20-8929-1046107592CB"/>
<body>from beagle</body>
<request xmlns="urn:xmpp:receipts"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="b14f47e7-9dcf-442c-a8ac-3c03664bacff" by="test@mix.tigase.im"/>
</message>
Andrzej Wójcik (Tigase) commented 4 years ago

@wojtek From what I can see, we have 3 messages:

  1. for MIX (that is OK)
  2. for MUC (that is OK)
  3. for MUC (duplicated message for MUC)

The question is why MUC sent 2 messages. It looks like it thinks that you have joined MIX via MUC 2 times. How many cluster nodes were up at this time?

Is it possible that you were joined/connected twice to 2 different nodes (even if you joined from a single resource)?

wojciech.kapcia@tigase.net commented 4 years ago

Hmm... OK, "my bad". I'll share more details below.

The question is why MUC sent 2 messages. It looks like it thinks that you have joined MIX via MUC 2 times. How many cluster nodes were up at this time?

3 - this is our tigase.im installation

Is it possible that you were joined/connected twice to 2 different nodes (even if you joined from a single resource)?

No, but… I was trying to create MIX/MUC room on tigase.im so I used my wojtek@tigase.im account in beagle to create channel and then decided to use Psi to check if MUC compatibility would work... and I used same wojtek@tigase.im account (so I was indeed receiving MIX and MUC messages).

However, the multiplication of the messages still happens - I joined in Psi using different account and I still get two copies:

<message id="ceba4407-93d8-4409-aa7b-aa2ee08d74be" type="groupchat" from="test@mix.tigase.im/Wojtek" to="wojtek@sure.im/Psi+">
<origin-id xmlns="urn:xmpp:sid:0" id="8F702C90-A66E-42DB-BE6E-79A8C3ED56A6"/>
<body>beagle3</body>
<request xmlns="urn:xmpp:receipts"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="ceba4407-93d8-4409-aa7b-aa2ee08d74be" by="test@mix.tigase.im"/>
</message>

<message id="ceba4407-93d8-4409-aa7b-aa2ee08d74be" type="groupchat" from="test@mix.tigase.im/Wojtek" to="wojtek@sure.im/Psi+">
<origin-id xmlns="urn:xmpp:sid:0" id="8F702C90-A66E-42DB-BE6E-79A8C3ED56A6"/>
<body>beagle3</body>
<request xmlns="urn:xmpp:receipts"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="ceba4407-93d8-4409-aa7b-aa2ee08d74be" by="test@mix.tigase.im"/>
</message>

I'm somewhat weary about receiving MIX and MUC messages at the same time (if someone uses Beagle and Conversation for example)

Andrzej Wójcik (Tigase) commented 4 years ago

After short discussion we were able to prove that this is happening only when user is "local" and not remote. Most likely this is caused by the code from ACS-MIX.

Andrzej Wójcik (Tigase) commented 4 years ago

I've applied changes to the logic which should fix this issue. @wojtek could you review my changes? (in ACS-MIX)

wojciech.kapcia@tigase.net commented 3 years ago

Seems that the issue re-surfaced:

<message from="tigase@mix.tigase.im/Licaon_Kter" type="groupchat" to="wojtek@sure.im/Psi+" xml:lang="en" id="d4e7314e-7faf-4800-bf31-3a770591f7dd">
<origin-id xmlns="urn:xmpp:sid:0" id="57f4213e-72fd-48f9-b9ad-95cbfdf76c06"/>
<body>Is this fixed yet?</body>
<stanza-id xmlns="urn:xmpp:sid:0" id="d4e7314e-7faf-4800-bf31-3a770591f7dd" by="tigase@mix.tigase.im"/>
</message>

<message from="tigase@mix.tigase.im/Licaon_Kter" type="groupchat" to="wojtek@sure.im/Psi+" xml:lang="en" id="d4e7314e-7faf-4800-bf31-3a770591f7dd">
<origin-id xmlns="urn:xmpp:sid:0" id="57f4213e-72fd-48f9-b9ad-95cbfdf76c06"/>
<body>Is this fixed yet?</body>
<stanza-id xmlns="urn:xmpp:sid:0" id="d4e7314e-7faf-4800-bf31-3a770591f7dd" by="tigase@mix.tigase.im"/>
</message>
Andrzej Wójcik (Tigase) commented 3 years ago

There was still an issue with MIX-MUC & MAM integration with Conversations which is sending <presence/> to join the room and without waiting for the answer it sends MAM requests. To fix that, I've changed the packet hash code generator for MIX (replaced PubSub logic with MUC logic). That should make it work for Conversations and should be good for now (we may need to tweak it in the future).

If this will not help, I'll modify permission checking for accessing the MAM archive in MIX to allow access to anyone who can join the channel (but that would be a workaround as according to default MIX channel configuration, only existing participants should be able to fetch MIX channel history).

wojciech.kapcia@tigase.net commented 3 years ago

Seems to work better. Thank you!

wojciech.kapcia@tigase.net commented 3 years ago

Currently if I join from two clients (Psi and Beagle) and send message from Psi I get double messages (with somewhat odd addressing)

<message type="groupchat" to="test@mix.tigase.im" id="acf8a">
<body>aaaa</body>
</message>

<message type="groupchat" to="wojtek@tigase.im/Psi+" id="ee1f3c1a-d0b1-436e-a206-daa85bbce8ea" from="test@mix.tigase.im/wojtek.im">
<body>aaaa</body>
<stanza-id xmlns="urn:xmpp:sid:0" id="ee1f3c1a-d0b1-436e-a206-daa85bbce8ea" by="test@mix.tigase.im"/>
</message>



<message type="groupchat" to="wojtek@tigase.im" id="ee1f3c1a-d0b1-436e-a206-daa85bbce8ea" from="test@mix.tigase.im/temp-b7fbc849f011e6070654fa7caf210a1bef9c67f8">
<body>aaaa</body>
<mix xmlns="urn:xmpp:mix:core:1">
<nick>wojtek.im</nick>
<jid>wojtek@tigase.im</jid>
</mix>
<stanza-id xmlns="urn:xmpp:sid:0" id="ee1f3c1a-d0b1-436e-a206-daa85bbce8ea" by="test@mix.tigase.im"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="1a1cc191-5871-499d-a983-1a73defae9c7" by="wojtek@tigase.im"/>
</message>

Message send from Beagle also generate two messages (in Psi via MUC):

<message type="groupchat" to="wojtek@tigase.im" id="87dbb66d-2a14-4427-82e6-3f74d4f46eba" from="test@mix.tigase.im/70c32889291698a6c6e98800892e7979763e1840">
<origin-id xmlns="urn:xmpp:sid:0" id="ACD22165-F663-4474-A1F3-52D5C63EB053"/>
<body>Beagle</body>
<request xmlns="urn:xmpp:receipts"/>
<markable xmlns="urn:xmpp:chat-markers:0"/>
<mix xmlns="urn:xmpp:mix:core:1">
<nick>Wojtek</nick>
<jid>wojtek@tigase.im</jid>
</mix>
<stanza-id xmlns="urn:xmpp:sid:0" id="87dbb66d-2a14-4427-82e6-3f74d4f46eba" by="test@mix.tigase.im"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="24f7c1be-1b91-42fc-9ea1-bda1c97391b0" by="wojtek@tigase.im"/>
</message>

<message type="groupchat" to="wojtek@tigase.im/Psi+" id="87dbb66d-2a14-4427-82e6-3f74d4f46eba" from="test@mix.tigase.im/Wojtek">
<origin-id xmlns="urn:xmpp:sid:0" id="ACD22165-F663-4474-A1F3-52D5C63EB053"/>
<body>Beagle</body>
<request xmlns="urn:xmpp:receipts"/>
<markable xmlns="urn:xmpp:chat-markers:0"/>
<stanza-id xmlns="urn:xmpp:sid:0" id="87dbb66d-2a14-4427-82e6-3f74d4f46eba" by="test@mix.tigase.im"/>
</message>
Andrzej Wójcik (Tigase) commented 3 years ago

@wojtek This is correct. That is how it works. MUC sends messages to full JID and MIX to the bare JID. There is nothing we can do about it except recommending to join with MIX or MUC but never with both. As Psi joins with MUC it receives MIX messages (due to bare jid routing) and MUC messages as it joined with MUC. That behavior is correct.

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