Projects tigase _server tigase-pubsub Issues #124
PubSub sends notifications about last published item on each presence received from subscriber. (#124)
Closed
Andrzej Wójcik (Tigase) opened 3 years ago

Before version 5.0.0 of PubSub, the owner of the node was automatically subscribed to create PubSub node during creation. That was an error and was fixed, however, it still causes issues with version 5.0.0 as with those subscriptions still in the database (as we were not able to remove them) and PubSub nodes configured with sending the last published item on "presence" it causes sending PubSub to send to the owner last published items on each and every presence change of the owner of the node.

This issue is mainly visible with PEP.

Andrzej Wójcik (Tigase) commented 3 years ago

To clean up those automatically created subscriptions on PostgreSQL, I've used following query:

delete
from tig_pubsub_subscriptions s where exists (
    select 1 from tig_pubsub_jids j
    inner join tig_pubsub_nodes n on s.node_id = n.node_id
    inner join tig_pubsub_service_jids sj on sj.service_id = n.service_id
    where
        j.jid_id = s.jid_id
        and lower(j.jid) = lower(sj.service_jid)
) ;

NOTE: This will delete also owners' self-subscriptions if they were manually created!

As for sending "notifications" when the presence is changed, I've modified PresenceCollectorModule to emit PresenceChangeEvent only when the user actually changed presence - become online or offline.

Andrzej Wójcik (Tigase) commented 3 years ago

As for cleanup, I would consider cleaning up our installations to reduce the load on the servers, however, I'm not sure if we can do that without "some" impact on our users. Most likely this would be some impact (if any) only for advanced users as people generally do not self-subscribe nodes on PEP.

wojciech.kapcia@tigase.net commented 3 years ago

@andrzej.wojcik What impact do you estimate on our installation (mostly in terms of benefits: how many pacts are currently generated due to this "bug" and how many users could be affected)?

Andrzej Wójcik (Tigase) commented 3 years ago

Any old users are affected now and if they are using OMEMO at least 2-5 nodes are sending notifications on every presence change. My fix would help with that.

Cleanup would help with initial presence processing (when resource connected and sent presence for the first time). That would reduce event message duplication, so PEP traffic from your local PEP service on "login" would be reduced by half.

As for the impact on users, I do not think anyone would use a subscription like that as most clients are using CAPS for that, so only advanced users with so custom software or manually subscribing with XMPP console.

wojciech.kapcia@tigase.net commented 3 years ago

I went ahead with the cleanup as per your recommendation. There weren't all that much subscriptions:

mysql> select count(*) from tig_pubsub_subscriptions;
+----------+
| count(*) |
+----------+
|      448 |
+----------+
1 row in set (0.00 sec)
```

Deleted roughly 80% of the entries:
```
mysql>     delete
    ->     from tig_pubsub_subscriptions s where exists (
    ->         select 1 from tig_pubsub_jids j
    ->         inner join tig_pubsub_nodes n on s.node_id = n.node_id
    ->         inner join tig_pubsub_service_jids sj on sj.service_id = n.service_id
    ->         where
    ->             j.jid_id = s.jid_id
    ->             and lower(j.jid) = lower(sj.service_jid)
    ->     ) ;
Query OK, 364 rows affected (0.01 sec)
```
issue 1 of 1
Type
Bug
Priority
Normal
Assignee
Version
tigase-server-8.2.0
Spent time
5h 15m
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-pubsub#124
Please wait...
Page is in error, reload to recover