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

AttributeError: 'RegistrationHandler' object has no attribute 'pusher_pool' #11769

Closed
anoadragon453 opened this issue Jan 19, 2022 · 0 comments · Fixed by #11770
Closed

AttributeError: 'RegistrationHandler' object has no attribute 'pusher_pool' #11769

anoadragon453 opened this issue Jan 19, 2022 · 0 comments · Fixed by #11770
Labels
T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. X-Regression Something broke which worked on a previous release X-Release-Blocker Must be resolved before making a release

Comments

@anoadragon453
Copy link
Member

When testing out commit d1e6333 on matrix.org today, we ended up with the following stacktrace:

stacktrace
2022-01-19 13:25:46,124 - synapse.http.server - 165 - ERROR - GET-847 - Failed handle request <XForwardedForRequest at 0x7f01352cf198 method='GET' uri='/_synapse/client/sso_register' clientproto='HTTP/1.1' site='8087'>
Capture point (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/synapse/src/synapse/app/generic_worker.py", line 514, in <module>
    main()
  File "/home/synapse/src/synapse/app/generic_worker.py", line 510, in main
    start(sys.argv[1:])
  File "/home/synapse/src/synapse/app/generic_worker.py", line 505, in start
    _base.start_worker_reactor("synapse-generic-worker", config)
  File "/home/synapse/src/synapse/app/_base.py", line 126, in start_worker_reactor
    run_command=run_command,
  File "/home/synapse/src/synapse/app/_base.py", line 179, in start_reactor
  File "/home/synapse/src/synapse/app/_base.py", line 163, in run
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/base.py", line 1318, in run
    self.mainLoop()
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/base.py", line 1328, in mainLoop
    reactorBaseSelf.runUntilCurrent()
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/base.py", line 967, in runUntilCurrent
    f(*a, **kw)
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/defer.py", line 662, in callback
    self._startRunCallbacks(result)
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/defer.py", line 764, in _startRunCallbacks
    self._runCallbacks()
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/defer.py", line 859, in _runCallbacks
    current.result, *args, **kwargs
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/defer.py", line 1751, in gotResult
    current_context.run(_inlineCallbacks, r, gen, status)
  File "/home/synapse/env-py37/lib/python3.7/site-packages/twisted/internet/defer.py", line 1661, in _inlineCallbacks
    result = current_context.run(gen.send, result)
  File "/home/synapse/src/synapse/http/server.py", line 195, in wrapped_async_request_handler
    await h(self, request)
Traceback (most recent call last):
  File "/home/synapse/src/synapse/http/server.py", line 269, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/home/synapse/src/synapse/http/server.py", line 297, in _async_render
    callback_return = await raw_callback_return
  File "/home/synapse/src/synapse/rest/synapse/client/sso_register.py", line 49, in _async_render_GET
    await self._sso_handler.register_sso_user(request, session_id)
  File "/home/synapse/src/synapse/handlers/sso.py", line 929, in register_sso_user
    request.getClientIP(),
  File "/home/synapse/src/synapse/handlers/sso.py", line 685, in _register_mapped_user
    auth_provider_id=auth_provider_id,
  File "/home/synapse/src/synapse/handlers/register.py", line 379, in register_user
    await self._register_email_threepid(user_id, threepid_dict, None)
  File "/home/synapse/src/synapse/handlers/register.py", line 995, in _register_email_threepid
    access_token=token_id,
AttributeError: 'RegistrationHandler' object has no attribute 'pusher_pool'

Sentry link for those with access: https://sentry.matrix.org/sentry/synapse-matrixorg/issues/239801/

@squahtx traced it back to this change. The issue is that this method, whose docstring states that it "Must be called on master." is being called on workers. matrix.org routes /_synapse/client/sso_register and other related SSO endpoints to one generic worker.

It appears there is an underlying bug here, however the existing code just happened to sidestep it (we don't attempt to make a pusher if token is None. This commit uncovers it with a partial fix, but that fix has ended up raising exceptions and causing worse problems.

A PR will come shortly that reverts the partial fix. Then hopefully a second PR that fixes the underlying issue (workers calling this function) properly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. X-Regression Something broke which worked on a previous release X-Release-Blocker Must be resolved before making a release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant