Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crash on pagination. #4263

Merged
merged 1 commit into from Feb 21, 2019

Conversation

Projects
None yet
4 participants
@rkfg
Copy link
Contributor

rkfg commented Dec 5, 2018

Today I've got pagination stuck on scrolling back and this was in the log:

2018-12-05 09:22:58,198 - synapse.http.server - 112 - ERROR - GET-8313- Failed handle request
via <function _async_render at 0x7f7d18ff8de8>: <SynapseRequest at 0x7f7ccb48d680
method=u'GET' uri=u'/_matrix/client/r0/rooms/<...>/messages?from=t361589-2272987_8803529_88_1180453_319160_392_21245_28472_14&
limit=20&dir=b&filter=%7B%22lazy_load_members%22%3Atrue%7D' clientproto=u'HTTP/1.0' site=8009>: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1475, in gotResult
    _inlineCallbacks(r, g, status)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 491, 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 81, in wrapped_request_handler
    yield h(self, request)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/http/server.py", line 316, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python2.7/dist-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python2.7/dist-packages/synapse/rest/client/v1/room.py", line 479, in on_GET
    event_filter=event_filter,
  File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/python2.7/dist-packages/synapse/handlers/pagination.py", line 266, in get_messages
    events[0].event_id, state_filter=state_filter,
exceptions.IndexError: list index out of range

So I added a check if events actually has something and then pagination worked again. No idea why it broke, I have some ignored users so maybe that's why.

@rkfg rkfg force-pushed the rkfg:develop branch 3 times, most recently from f4c009e to 18b87ee Dec 6, 2018

@rkfg rkfg force-pushed the rkfg:develop branch from 18b87ee to ae19a7d Dec 6, 2018

@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Dec 6, 2018

Codecov Report

Merging #4263 into develop will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4263      +/-   ##
===========================================
- Coverage    73.63%   73.62%   -0.01%     
===========================================
  Files          298      298              
  Lines        29776    29776              
  Branches      4875     4875              
===========================================
- Hits         21925    21923       -2     
- Misses        6419     6420       +1     
- Partials      1432     1433       +1
Impacted Files Coverage Δ
synapse/handlers/pagination.py 91.66% <100%> (ø) ⬆️
synapse/state/v1.py 90.69% <0%> (-1.56%) ⬇️
synapse/state/v2.py 93.29% <0%> (-0.52%) ⬇️
synapse/handlers/user_directory.py 71.03% <0%> (+0.3%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0c24a6...ae19a7d. Read the comment docs.

@erikjohnston

This comment has been minimized.

Copy link
Member

erikjohnston commented Feb 21, 2019

Thanks! Sorry for taking so long to look at it.

@erikjohnston erikjohnston merged commit b9d6756 into matrix-org:develop Feb 21, 2019

5 checks passed

ci/circleci: sytestpy2merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy2postgresmerged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3merged Your tests passed on CircleCI!
Details
ci/circleci: sytestpy3postgresmerged Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@@ -0,0 +1 @@
Prevent crash on pagination.

This comment has been minimized.

Copy link
@richvdh

richvdh Feb 27, 2019

Member

@erikjohnston please can we not use the word "crash" when we mean "throw an exception". "crash" sounds like the whole process dies.

@rkfg rkfg deleted the rkfg:develop branch Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.