matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.8k stars 2.13k forks source link

Failed to remove user from community #5144

Closed popindavibe closed 2 years ago

popindavibe commented 5 years ago

Description

When, as the admin of the community, I remove a user which is not a local user, I get the following message in the client:

Error Failed to remove user from community

Please note that the user ends up in a between state, not in the list of members any more but still having visibility over the community (even after reload / sign out / sign in). Actually that user cannot leave the community either once he doesn't appear in the members' list.

Steps to reproduce

Expected

Same behaviour for local/ external users, whether they leave on their own or are kicked out.

Also please note that if the external user chooses to leave on his own, there are no issues, he leaves as a member and the community disappears as well.

From the synapse server I get:

May 06 17:52:54 allium python[31727]: 2019-05-06 17:52:54,012 - synapse.http.server - 112 - ERROR - PUT-767- Failed handle request via 'GroupAdminUsersKickServlet': <XForwardedForRequest at 0x7f155ff41c50 method='PUT' uri='/_matrix/client/r0/groups/%2Bacmecorp%3Amatrix.example.com/admin/users/remove/%40acmecorp%3Amatrix.org' clientproto='HTTP/1.1' site=8008>
May 06 17:52:54 allium python[31727]: Traceback (most recent call last):
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/server.py", line 81, in wrapped_request_handler
May 06 17:52:54 allium python[31727]:     yield h(self, request)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
May 06 17:52:54 allium python[31727]:     result = result.throwExceptionIntoGenerator(g)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
May 06 17:52:54 allium python[31727]:     return g.throw(self.type, self.value, self.tb)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/server.py", line 316, in _async_render
May 06 17:52:54 allium python[31727]:     callback_return = yield callback(request, **kwargs)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
May 06 17:52:54 allium python[31727]:     result = result.throwExceptionIntoGenerator(g)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
May 06 17:52:54 allium python[31727]:     return g.throw(self.type, self.value, self.tb)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/rest/client/v2_alpha/groups.py", line 575, in on_PUT
May 06 17:52:54 allium python[31727]:     group_id, user_id, requester_user_id, content,
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
May 06 17:52:54 allium python[31727]:     result = result.throwExceptionIntoGenerator(g)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
May 06 17:52:54 allium python[31727]:     return g.throw(self.type, self.value, self.tb)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/handlers/groups_local.py", line 408, in remove_user_from_group
May 06 17:52:54 allium python[31727]:     group_id, user_id, requester_user_id, content,
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
May 06 17:52:54 allium python[31727]:     result = result.throwExceptionIntoGenerator(g)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
May 06 17:52:54 allium python[31727]:     return g.throw(self.type, self.value, self.tb)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/groups/groups_server.py", line 812, in remove_user_from_group
May 06 17:52:54 allium python[31727]:     get_domain_from_id(user_id), group_id, user_id, {}
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
May 06 17:52:54 allium python[31727]:     result = result.throwExceptionIntoGenerator(g)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/python/failure.py", line 512, in throwExceptionIntoGenerator
May 06 17:52:54 allium python[31727]:     return g.throw(self.type, self.value, self.tb)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/matrixfederationclient.py", line 639, in post_json
May 06 17:52:54 allium python[31727]:     ignore_backoff=ignore_backoff,
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
May 06 17:52:54 allium python[31727]:     result = g.send(result)
May 06 17:52:54 allium python[31727]:   File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/matrixfederationclient.py", line 427, in _send_request
May 06 17:52:54 allium python[31727]:     raise e
May 06 17:52:54 allium python[31727]: synapse.api.errors.HttpResponseException: 400: b'Bad Request'

Version information

thegcat commented 4 years ago

I can confirm this behaviour. As this happens between 2 servers I administer, I can offer the view from the receiving end:

Apr 29 23:05:34 matrix matrix-synapse[633]: 2020-04-29 23:05:34,874 - synapse.http.servlet - 228 - WARNING - POST-601524 - Unable to parse JSON: Expecting value: line 1 column 1 (char 0)
Apr 29 23:05:34 matrix matrix-synapse[633]: 2020-04-29 23:05:34,874 - synapse.http.server - 81 - INFO - POST-601524 - <XForwardedForRequest at 0x7f6d77e87210 method='POST' uri='/_matrix/federation/v1/groups/local/%2B480%3Akif.rocks/users/%40thegcat%3Afachschaften.org/remove' clientproto='HTTP/1.1' site=8008> SynapseError: 400 - Content not JSON.
Apr 29 23:05:34 matrix matrix-synapse[633]: 2020-04-29 23:05:34,875 - synapse.access.http.8008 - 302 - INFO - POST-601524 - 10.0.42.202 - 8008 - {None} Processed request: 0.001sec/0.000sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 52B 400 "POST /_matrix/federation/v1/groups/local/%2B480%3Akif.rocks/users/%40thegcat%3Afachschaften.org/remove HTTP/1.1" "Synapse/1.12.4" [0 dbevts]
thegcat commented 4 years ago

Any idea where I would go looking to see why no json was passed and/or which side expects something that's not up to spec?

clokep commented 2 years ago

Communities/groups are being removed, see #11584.