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

synapse.app.admin_cmd produces CRITICAL - sentinel - main function encountered error #11562

Open
samuel-p opened this issue Dec 12, 2021 · 4 comments
Labels
P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@samuel-p
Copy link
Contributor

Description

I tried running the synapse.app.admin_cmd to export the data for one of my users, but got the following error:

2021-12-12 17:09:12,104 - twisted - 275 - CRITICAL - sentinel - main function encountered error
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 662, in callback
    self._startRunCallbacks(result)
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 764, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 858, in _runCallbacks
    current.result = callback(  # type: ignore[misc]
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 1751, in gotResult
    current_context.run(_inlineCallbacks, r, gen, status)
--- <exception caught here> ---
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 1661, in _inlineCallbacks
    result = current_context.run(gen.send, result)
  File "/usr/local/lib/python3.8/site-packages/synapse/app/admin_cmd.py", line 241, in run
    await args.func(ss, args)
  File "/usr/local/lib/python3.8/site-packages/synapse/app/admin_cmd.py", line 80, in export_data_command
    res = await hs.get_admin_handler().export_user_data(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/admin.py", line 174, in export_user_data
    events = await filter_events_for_client(self.storage, user_id, events)
  File "/usr/local/lib/python3.8/site-packages/synapse/visibility.py", line 259, in filter_events_for_client
    return [ev for ev in filtered_events if ev]
  File "/usr/local/lib/python3.8/site-packages/synapse/visibility.py", line 259, in <listcomp>
    return [ev for ev in filtered_events if ev]
  File "/usr/local/lib/python3.8/site-packages/synapse/visibility.py", line 149, in allowed
    oldest_allowed_ts = storage.main.clock.time_msec() - max_lifetime
builtins.AttributeError: 'AdminCmdSlavedStore' object has no attribute 'clock'

Steps to reproduce

I just ran the following command in the main synapse Docker-Container on my Server:

python -m synapse.app.admin_cmd -c /data/homeserver.yaml export-data @user:my.server.com

Version information

  • Homeserver: matrx.sp-codes.de

If not matrix.org:

  • Version: 1.48.0

  • Install method: Docker

  • Platform: Debian
@dklimpel
Copy link
Contributor

I tested it with the debian package version 1.47.1 and had no problems.

@squahtx
Copy link
Contributor

squahtx commented Dec 13, 2021

To reproduce the error, a retention policy needs to be configured

@squahtx
Copy link
Contributor

squahtx commented Dec 13, 2021

Another bug that would have been caught by #11165
Two of the three *DataStore classes have a clock attribute. The admin one doesn't.

@reivilibre reivilibre added S-Major Major functionality / product severely impaired, no satisfactory workaround. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Dec 14, 2021
@squahtx squahtx closed this as completed Dec 16, 2021
@squahtx squahtx reopened this Dec 16, 2021
@callahad callahad added S-Minor Blocks non-critical functionality, workarounds exist. and removed S-Major Major functionality / product severely impaired, no satisfactory workaround. labels Dec 16, 2021
@callahad
Copy link
Contributor

Retention policies are still quite experimental, so we can't commit to supporting things that are broken by them, but we would absolutely accept a patch which resolved this issue.

As a workaround, temporarily disabling the retention policy may allow the command to succeed.

@callahad callahad added the P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches label Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P4 (OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches 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

5 participants