Skip to content

New admin redact endpoint doesn't work when setting run_background_tasks_on #17823

@morguldir

Description

@morguldir

Description

The redact tasks seems to only work for processes with the admin handler running, which is only the main process, due to there being a block disabling the admin handler if it's running as a worker

The redact task is registered here https://github.com/element-hq/synapse/blob/v1.117.0rc1/synapse/handlers/admin.py#L72-L74

I've successfully used the purge room endpoint with the background worker before, which i believe is because the task is registered in the pagination handler here instead https://github.com/element-hq/synapse/blob/v1.117.0rc1/synapse/handlers/pagination.py#L131-L133

Steps to reproduce

  • Run admin command to redact https://matrix.sulian.eu/_synapse/admin/v1/user/@morguldir:sulian.eu/redact
  • See that the task gets stuck with https://matrix.sulian.eu/_synapse/admin/v1/user/redact_status/sVZFiCXPYhyBSUjt
  • Check logs and see that it didn't recognize the task

Homeserver

sulian.eu

Synapse Version

1.117.0rc1

Installation Method

Docker (matrixdotorg/synapse)

Database

postgres 15.6, split main and state

Workers

Multiple workers

Platform

kubespray + containerd + ananace/charts + synapse docker image

Configuration

run_background_tasks_on
Presence
limit_profile_requests_to_users_who_share_rooms
MSC3266
MSC2815

Relevant log output

matrix-synapse-background-tasker-5875d8c798-b5pvv background-tasker Exception: No function associated with action redact_all_events of the scheduled task sVZFiCXPYhyBSUjt

Anything else that would be useful to know?

Commenting out run_background_tasks_on made the redaction go through instantly

Although it still failed with this error matrix-synapse-86b9446569-rv8sc synapse 2024-10-12 18:43:16,033 - synapse.handlers.admin - 492 - INFO - task-redact_all_events-0-sVZFiCXPYhyBSUjt- Redaction of event $Xgmx26-_7Wsh_a3_WE0uCqRTb6If6RqKn38mg1YOI6g failed due to: User must be our own: @nex:nexy7574.co.uk, but worked when i tried it on myself.

I'm curious if it would make sense to let the command run the redactions as the admin user, if they have sufficient permission in the room

I also noticed that you can redact events even after you leave a room, although this will most likely soft fail on any other servers 🤔

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions