Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

garbage collect forgotten rooms #4720

Closed
ara4n opened this issue Feb 23, 2019 · 24 comments · Fixed by #15488
Closed

garbage collect forgotten rooms #4720

ara4n opened this issue Feb 23, 2019 · 24 comments · Fixed by #15488
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Time-Tracked Element employees should track their time spent on this issue/PR.

Comments

@ara4n
Copy link
Member

ara4n commented Feb 23, 2019

if everyone on a server has left and forgotten a given room, we should GC it from the DB

@neilisfragile neilisfragile added z-p2 (Deprecated Label) enhancement labels Feb 26, 2019
@richvdh richvdh changed the title garbage collect forgotton rooms garbage collect forgotten rooms Feb 26, 2019
@aaronraimist
Copy link
Contributor

This should probably get a Mozilla label https://bugzilla.mozilla.org/show_bug.cgi?id=1622403

@schildbach
Copy link

This seems like no-brainer to me. I just deleted gigabytes of data from my postgres DB just by manually removing abandoned rooms.

@peterhoeg
Copy link

Do you have a (relatively) safe script to do that @schildbach ?

@ptman
Copy link
Contributor

ptman commented Aug 11, 2020

@peterhoeg you can get a list of rooms and remove them via the admin api: https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/rooms.md

Directly modifying the database is error prone and should not be done.

Also synapse admin ui can let you click around instead of writing code for the API: https://github.com/Awesome-Technologies/synapse-admin

@schildbach
Copy link

@peterhoeg I used the instructions provided here. Yes, it uses the admin API for write operations. Still, I think synapse could automatically purge a room if the last local user left it.

@clokep
Copy link
Member

clokep commented Aug 11, 2020

I suspect to have this done automatically we would want to:

  1. Add a background update that searches for rooms with 0 joined members.
  2. Iterates over them and calls purge.

There's a couple of tricky pieces here:

  1. Do we care how long ago this had no members in it? (Do you want to immediately purge the room or wait a few days?)
  2. Some logic to ensure only a single background update is running at once, as purging can take a while.

@clokep clokep added the Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution label Aug 11, 2020
@schildbach
Copy link

schildbach commented Aug 11, 2020

Alternatively, it could simply purge immediately, within the "last member left" operation. For me, waiting a few days doesn't add any value.

@olmari
Copy link
Contributor

olmari commented Dec 5, 2020

How about following set retention minimum policy? Would be most logical, so in case of fould play it would still be there to dig if so needed within same retention policy numbers as any other related event.

@ara4n
Copy link
Member Author

ara4n commented May 1, 2021

I suspect to have this done automatically we would want to:

  1. Add a background update that searches for rooms with 0 joined members.

N.B. a room with 0 joined members is distinct from a room where all the local members have explicitly forgotten it. You should only purge/gc ones which have been explicitly forgotten, rather than just parted (given we let users read their historical rooms unless they forget them - like a recycle bin in a filemanager).

@erikjohnston erikjohnston added T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution and removed z-enhancement Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p2 (Deprecated Label) labels May 20, 2021
aaronraimist added a commit to aaronraimist/Dokumentation that referenced this issue Aug 6, 2022
Synapse does not do this. That is an open request but it has not been implemented. matrix-org/synapse#4720

I sent a message in May,https://matrix.to/#/!tIWQjETAJquswcgSTQ:tu-dresden.de/$nbbHykJfc8OJBeQ2R0hbvf3mgAtczsGSTXPidH5nzkc?via=tu-dresden.de&via=matrix.org&via=ungleich.ch, asking  if this was a custom feature implemented by your university or if this sentence was a result of misunderstanding how Synapse works. I never got a response so I am making this PR to remove the misleading information. If this is a custom feature then please clarify that in the documentation.
@richvdh
Copy link
Member

richvdh commented Aug 16, 2022

Note that #11521 would be a blocker for this.

@anoadragon453 anoadragon453 added Z-Time-Tracked Element employees should track their time spent on this issue/PR. and removed Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution labels Oct 13, 2022
@richvdh
Copy link
Member

richvdh commented Oct 14, 2022

This is also somewhat related to GDPR: if all users in a room are deactivated, the room itself should be garbage collected (element-hq/riot-meta#165).

@richvdh
Copy link
Member

richvdh commented Oct 14, 2022

Obviously, when a room is deleted, we should also delete any media only referenced from that room (see also #1263)

@ghost
Copy link

ghost commented Oct 16, 2022

@richvdh Would it be possible to transfer #element-hq/riot-meta#165 to element-meta, if the issue is still relevant?

@richvdh
Copy link
Member

richvdh commented Oct 17, 2022

@richvdh Would it be possible to transfer vector-im/riot-meta#165 to element-meta, if the issue is still relevant?

Not without unarchiving the project, which is too much like hard work.

@DemiMarie
Copy link

Spaces also need to be subject to garbage collecition.

@olmari
Copy link
Contributor

olmari commented Jul 24, 2023

@DemiMarie Well, space is an room, so I'd imagine all this will touch spaces too(?)

@DemiMarie
Copy link

@olmari from a user perspective the two are not the same.

@Malix-Labs
Copy link

Malix-Labs commented Sep 27, 2023

Spaces also need to be subject to garbage collection.

Can someone confirm it currently is / isn't ?

@Malix-Labs
Copy link

Also, is the garbage collection process instant after the last user forgot the room?
If not, how often does the garbage collection process occur?

@schildbach
Copy link

It seems like you need to add

forgotten_room_retention_period: 1d

to your homeserver.yaml and that implies it isn't instant.

@Malix-Labs
Copy link

It seems like you need to add

forgotten_room_retention_period: 1d

to your homeserver.yaml and that implies it isn't instant.

Nice to know.
Is 1d the minimum value for forgotten_room_retention_period?
Do you have documentation about it?

@clokep
Copy link
Member

clokep commented Sep 27, 2023

Spaces also need to be subject to garbage collection.

Can someone confirm it currently is / isn't ?

Spaces will also be cleaned up, they're just rooms.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Time-Tracked Element employees should track their time spent on this issue/PR.
Projects
None yet
Development

Successfully merging a pull request may close this issue.