synapse icon indicating copy to clipboard operation
synapse copied to clipboard

purge_up_to_ts in purge history api is broken

Open 4nd3r opened this issue 8 years ago • 3 comments

# 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

4nd3r avatar Apr 07 '18 19:04 4nd3r

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 avatar Apr 09 '18 23:04 richvdh

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

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

ukcb avatar Apr 28 '18 07:04 ukcb

fixed by #3160

richvdh avatar May 03 '18 10:05 richvdh