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

purge_up_to_ts in purge history api is broken #3076

Closed
4nd3r opened this issue Apr 7, 2018 · 3 comments
Closed

purge_up_to_ts in purge history api is broken #3076

4nd3r opened this issue Apr 7, 2018 · 3 comments
Labels
Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution

Comments

@4nd3r
Copy link
Contributor

4nd3r commented Apr 7, 2018

# curl -X POST --data '{ "delete_local_events": true, "purge_up_to_ts": 1523127593000 }' 'http://127.0.0.1:8008/_matrix/client/r0/admin/purge_history/!redacted/?access_token=redacted'
{
    "errcode": "M_UNKNOWN",
    "error": "Internal server error"
}

2018-04-07 22:01:15,933 - synapse.http.server - 191 - ERROR - POST-1797969- Failed handle request synapse.http.server._async_render on <synapse.rest.ClientRestResource object at 0x7f4bddc09290>: <XForwardedForRequest at 0x7f4b7da44290 method=POST uri=/_matrix/client/r0/admin/purge_history/!redacted/?access_token=<redacted> clientproto=HTTP/1.1 site=8008>: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 651, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1355, in gotResult
    _inlineCallbacks(r, g, deferred)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1297, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 162, in wrapped_request_handler
    yield request_handler(self, request, request_metrics)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1297, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 389, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 307, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1299, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/python2.7/dist-packages/synapse/rest/client/v1/admin.py", line 173, in on_POST
    room_id, stream_ordering,
exceptions.TypeError: 'NoneType' object is not iterable

debian stretch and matrix-synapse 0.27.2-1

@richvdh
Copy link
Member

richvdh commented Apr 9, 2018

Sigh. Yes. Apparently if the server can't find any events in the room after the cutoff time it throws this exception.

The problem is here:

            (_, depth, _) = (
                yield self.store.get_room_event_after_stream_ordering(
                    room_id, stream_ordering,
                )
            )

get_room_event_after_stream_ordering returns None, which then can't be assigned to (_, depth, _)

@richvdh richvdh added the Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution label Apr 9, 2018
@ukcb
Copy link

ukcb commented Apr 28, 2018

Please fix this Issue, my log file get bigger and bigger.

# grep NoneType /var/log/matrix-synapse/homeserver.log | wc -l
1768

@richvdh
Copy link
Member

richvdh commented May 3, 2018

fixed by #3160

@richvdh richvdh closed this as completed May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution
Projects
None yet
Development

No branches or pull requests

3 participants