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

Inviting a user to a group twice breaks the group #2633

Closed
vurpo opened this issue Nov 3, 2017 · 11 comments
Closed

Inviting a user to a group twice breaks the group #2633

vurpo opened this issue Nov 3, 2017 · 11 comments
Labels
z-bug (Deprecated Label) z-p3 (Deprecated Label)

Comments

@vurpo
Copy link

vurpo commented Nov 3, 2017

Description

After the same user joined a group twice, all requests for group information now return a 500 Internal Server Error

Steps to reproduce

  • Invite a user to a group (using the /groups/:group_id/admin/users/invite/:user_id API)
  • Have the user accept the invitation
  • Repeat steps 1 and 2
  • Now Riot only says "Failed to load group ID" (and looking at the debug console in Riot reveals that all the requests are returning a 500 Internal Server Error)

I just realized I had a broken log config for this HS, so I have no homeserver.log to look in. I can fix that and then look at the logs though, if that's necessary

Version information

  • Homeserver: godotengine.org
  • Version: Synapse 0.24.1
  • Install method: git clone
  • Platform: Regular Fedora installation (no VM/container)
@vurpo
Copy link
Author

vurpo commented Nov 3, 2017

I found this line in the homeserver.log, which makes the issue seem pretty self-explanatory:

2017-11-03 02:15:18,094 - synapse.http.server - 123 - INFO - GET-10- <SynapseRequest at 0x7fc8ac1cfb00 method=GET uri=/_matrix/client/r0/groups/%2Bgodot%3Agodotengine.org/users?access_token=<redacted> clientproto=HTTP/1.1 site=8449> SynapseError: 500 - More than one row matched

@Valodim
Copy link
Contributor

Valodim commented Jan 24, 2018

This just happened to me. A user joined a group but got an error (don't have an exact error msg, "Couldn't join group" or something like that), so I invited them again. Now the group can't be listed anymore in Riot.

Checking the database, there are two entries for this user in group_users, and also in attestations_remote. There is no unique index on group_users or the attestation tables, is that intentional? Either way, something is definitely up here..

The user in this case is on matrix.org (do you have the duplicate entry too, now?), the group is on stratum0.org.

@vurpo
Copy link
Author

vurpo commented Jan 24, 2018

@Valodim I had to fix this by manually deleting the duplicate rows in the database

@necessary129
Copy link

Got hit with this bug a couple of time now. 😞

@Cadair
Copy link
Contributor

Cadair commented Apr 24, 2018

I have also got hit with this twice in the last two days. The last person to trigger it claims that he only pressed the join community button once!

@vurpo
Copy link
Author

vurpo commented Apr 24, 2018

This appears to be the TODO regarding this issue.

@Cadair
Copy link
Contributor

Cadair commented Apr 24, 2018

This does appear to have been made significantly worse by the introduction of publicly joinable groups as that TODO will not stop someone joining a public group twice.

I wonder if this could just be fixed by having SQL enforce uniqueness rather than doing it in the synapse code?

@thegcat
Copy link
Contributor

thegcat commented May 27, 2018

Is this closed by #3128 and #3129?

@benparsons
Copy link
Member

benparsons commented Jul 24, 2018

It seems that this issue has started appearing again. In particular, we have seen it happening on

+polynomial-supporters:matrix.org
and
+community:matrix.org

Wherever the problem occurs we see MatrixError {errcode: "M_UNKNOWN", name: "M_UNKNOWN", message: "More than one row matched", data: {…}, httpStatus: 500} in the riot console.

@turt2live
Copy link
Member

fwiw I saw this when the user tried to accept their second invite, not when the invite was issued.

jryans added a commit to jryans/matrix-react-sdk that referenced this issue Nov 23, 2018
Synapse is currently known (matrix-org/synapse#2633) to return 500 errors for
requests to `/groups/$groupId/users` when a user has multiple invites to the
group.

If you are affected by this issue, Riot will display a community invite when you
select it for a few seconds until it receives this 500 error, but then it will
replace the invite view with a "Failed to load <group>" message.

By ignoring this error response in Riot for now, it is possible to view and
accept the invite.

Signed-off-by: J. Ryan Stinnett <[email protected]>
jryans added a commit to jryans/matrix-react-sdk that referenced this issue Nov 23, 2018
Synapse is currently known (matrix-org/synapse#2633) to return 500 errors for
requests to `/groups/$groupId/users` when a user has multiple invites to the
group.

If you are affected by this issue, Riot will display a community invite when you
select it for a few seconds until it receives this 500 error, but then it will
replace the invite view with a "Failed to load <group>" message.

By ignoring this error response in Riot for now, it is possible to view and
accept the invite.

Fixes element-hq/element-web#7727.

Signed-off-by: J. Ryan Stinnett <[email protected]>
@richvdh richvdh added the z-bug (Deprecated Label) label Mar 19, 2020
@clokep
Copy link
Member

clokep commented Apr 26, 2022

Communities/groups are being removed, see #11584.

@clokep clokep closed this as completed Apr 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label) z-p3 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

10 participants