-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
device_inbox never gets emptied #3599
Comments
The main problem is that it's hard to tell when we can delete to-device messages. They don't have an expiry time on them. |
I made a small test script for private use with postgresql. Let's see if it works. :-)
|
It would be better if the table device_inbox already had a timestamp. That would make purging up a lot easier. Technically, that should not be a problem. |
Is there currently any official solution to this?
|
@Midek what version of Synapse are you on? Recent versions of Synapse should have deleted quite a bit |
My synapse version is:
If anything, i have noticed it started growing more rapidly quite recently (so perhaps after one of the more recent updates), but i cannot pinpoint exactly when, since the table was always quite large. //edit
device_inbox has exactly this many records:
And my synapse instance is using workers. |
@Midek there is a background update job in 1.47 (whose performance was improved in 1.48) which removes to_device messages for hidden and deleted devices. You could check to see what background updates are running, with FWIW, device_inbox messages should get deleted once they're:
You could try looking to see which devices have all these unread messages. Something like this, perhaps, but beware: I expect this query will take a while if it's got to scan 80GB of records.
I would only start investigating down this line if there are no rows in |
Oh, i do have event_arbitrary_relations and remove_dead_devices_from_device_inbox in background_updates
So this is normal and should just fix itself after the background jobs are done, i guess? |
I think things will get better after the As @richvdh notes, there's no inherent mechanism for expiring these messages if the client doesn't acknowledge their receipt. Perhaps there ought to be? Unsure---there may be ramifications for E2EE) |
The
i have noticed that there are multiple users with over 1mln results. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@acheng-floyd your questions are unrelated to this issue, but in short, those Deleting entries from |
If the recipient devices are deleted (there is an Admin API for doing so) then the corresponding to-device messages will be deleted as well. Likewise if the user is completely deactivated - which in turn erases all of their devices. On just removing the entries from the table and leaving the devices in place however - there shouldn't be much that breaks other than the ability to decrypt past messages, no. If the ability to decrypt past messages is definitely not a concern for the accounts in question (know that sometimes people come back to their accounts after years of inactivity!), then feel free to remove them to save space. While the rows in One last note: @DMRobertson is right in that to-device messages can accumulate for accounts that just sit in encrypted rooms all day, don't And finally: encourage your users to remove log out old devices that they are no longer using. Chances are these are the ones that are racking up a backlog of to-device messages to begin with. |
it's now up to 3.6 billion rows... |
From my understanding of to device messages for sliding sync, the vast vast majority (94%) of these messages are |
The disk wastage here is crazy. can I suggest we add a bg job to:
|
Was there any resolution to this problem. I see the same thing on my install |
it's up to 85M rows or so on matrix.org, which seems insane. similarly *_stream never seem to get purged, or device_federation_inbox/outbox
The text was updated successfully, but these errors were encountered: