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

MSC1763 retention purge_jobs fail to run when run_background_tasks_on is configured to be a synapse.app.generic_worker #13604

Closed
bradtgmurray opened this issue Aug 23, 2022 · 4 comments
Labels
A-Message-Retention-Policies Issues related to Synapse's support of MSC1763 (message retention policies) O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@bradtgmurray
Copy link
Contributor

Description

m.room.retention state events are correctly filtering out events in the endpoints, but the purge jobs aren't correctly running and the events are still in the database.

Seeing this error log which points pretty clearly at the issue
{"log":"[purge] failed","namespace":"synapse.handlers.pagination","level":"ERROR","time":1661238458.09,"request":"_purge_history-0","server_name":"beeper.com","exc_type":"AttributeError","exc_value":"'GenericWorkerSlavedStore' object has no attribute 'purge_history'"}

Can we just add PurgeEventsStore to GenericWorkerSlavedStore or can only the main process purge events? 🤔

Steps to reproduce

Relevant config:

run_background_tasks_on: synapse-background-worker-0

retention:
  enabled: true

so it's just the default daily job.

synapse-background-worker-0 is the hostname of a synapse.app.generic_worker process configured to run background jobs.

Homeserver

beeper.com

Synapse Version

1.64.0 (Beeper fork)

Installation Method

No response

Platform

Running in containers on Kubernetes.

Relevant log output

{"log":"[purge] failed","namespace":"synapse.handlers.pagination","level":"ERROR","time":1661238458.33,"request":"_purge_history-7","server_name":"beeper.com","exc_type":"AttributeError","exc_value":"'GenericWorkerSlavedStore' object has no attribute 'purge_history'"}
{"log":"[purge] Attempting to purge messages in room !XPxwZVXpPnNWmrJQwB:beeper.com","namespace":"synapse.handlers.pagination","level":"INFO","time":1661238458.31,"request":"purge_history_for_rooms_in_range-0","server_name":"beeper.com"}


### Anything else that would be useful to know?

_No response_
@DMRobertson DMRobertson added S-Minor Blocks non-critical functionality, workarounds exist. A-Message-Retention-Policies Issues related to Synapse's support of MSC1763 (message retention policies) O-Uncommon Most users are unlikely to come across this or unexpected workflow T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Aug 24, 2022
@DMRobertson
Copy link
Contributor

Can we just add PurgeEventsStore to GenericWorkerSlavedStore or can only the main process purge events?

Difficult to say. There's wording here which makes it sound like there should only be one purge running at a time across the entire application (all workers).

Note that only a single purge can occur at once, this is guaranteed via
a higher level (in the PaginationHandler).

Naively: I'd be scared of deleting on events from workers that aren't event persisters. Can't give you an authoritative answer, though; any ideas from @matrix-org/synapse-core?

@DMRobertson DMRobertson added O-Occasional Affects or can be seen by some users regularly or most users rarely O-Uncommon Most users are unlikely to come across this or unexpected workflow and removed O-Uncommon Most users are unlikely to come across this or unexpected workflow O-Occasional Affects or can be seen by some users regularly or most users rarely labels Aug 24, 2022
@erikjohnston
Copy link
Member

I think the quick option here is to change the purge background job to ignore run_background_tasks_on config option and to always run on master (which is what it will do by default)

@clokep
Copy link
Member

clokep commented Aug 25, 2022

Seems like #8513 might have regressed this?

@clokep
Copy link
Member

clokep commented Aug 25, 2022

This seems to be a duplicate of #9927!

@clokep clokep closed this as completed Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Message-Retention-Policies Issues related to Synapse's support of MSC1763 (message retention policies) O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

4 participants