Clients not receiving group messages, yet they're reported to be group members
See original GitHub issueDescribe the bug
We have a front-end web server that negotiates with SignalR for users and manages their group memberships. We also have a back-end service that is blindly firing events to various groups based on external events.
While everything is running, if I use the API to check if a test user is in a group that they should be in, SignalR says they are a member however they never receive messages sent to the group. But if I manually add the user using the MessagePublisher sample project, the client automatically starts receiving messages properly.
Are there any situations where SignalR would say a user is a member and yet they wouldn’t receive messages?
To Reproduce
Setup
- Use Azure SignalR in
Serverless
mode. - Use
Microsoft.Azure.SignalR.Management
to manage hubs. - Have a client already connected with the userId and listening for messages.
return ServiceManager.GenerateClientAccessToken(hubName, userId);
Steps
- Add user to UserGroup.
await hub.UserGroups.AddToGroupAsync(userId, groupName, ct);
- Send message to Group from the backend.
await hub.Clients.Group(groupName).SendCoreAsync(methodName, args, ct);
- Client doesn’t receive the message.
However, if I add the user to the group via a debug app or something else then the user starts receiving messages.
Further technical details
Microsoft.Azure.SignalR
v1.5.1Microsoft.Azure.SignalR.Management
v1.5.1@microsoft/signalr
v3.1.10
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
Thanks for your repo. For now, the operations about user join/leave group are fire-and-forget. Too soon operation of leave then join group will cause the wierd status of the user in/out of some group. For now the workaround is to to wait a little time (maybe one second) to between user-group action operations (user join/leave group) and wait a short time before sending message to group. We are trying to fix this issue. Another workaround is to use connection-group operations as @Liangying Weimailto:lianwei@microsoft.com mentioned.
Thanks, Wanpeng Li
From: Bryce Barbara notifications@github.com Sent: Wednesday, November 25, 2020 2:57:57 AM To: Azure/azure-signalr azure-signalr@noreply.github.com Cc: Wanpeng Li Wanpeng.Li@microsoft.com; Mention mention@noreply.github.com Subject: Re: [Azure/azure-signalr] Clients not receiving group messages, yet they’re reported to be group members (#1125)
Repro repo: https://github.com/BryceBarbara/AzureSignalRUserGroupsIssuehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBryceBarbara%2FAzureSignalRUserGroupsIssue&data=04|01|Wanpeng.Li%40microsoft.com|d4f78d1cac6c47d49dc908d890aadbdb|72f988bf86f141af91ab2d7cd011db47|1|0|637418410796494128|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=OH5Vk3dgy8zmg0PONX4tfsINk0bcTvz61ndIxyJBey0%3D&reserved=0
The readme in the repo should walk you through how to reproduce this issue. While testing this on my end, I was only able to reproduce it when using our Prod Azure SignalR service which is on the Standard pricing tier. Our dev SignalR service on the Free tier did not display this odd behavior.
To summarize what I had to do to cause the issue:
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2Fazure-signalr%2Fissues%2F1125%23issuecomment-733171278&data=04|01|Wanpeng.Li%40microsoft.com|d4f78d1cac6c47d49dc908d890aadbdb|72f988bf86f141af91ab2d7cd011db47|1|0|637418410796504087|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=89Pyx2VTjZREuOZ%2B%2F2bOWFfvtykCQ0uMr4XjDD%2BdukQ%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJDW7OLLEJ6JQAQRX44TF63SRP63LANCNFSM4UACEC4Q&data=04|01|Wanpeng.Li%40microsoft.com|d4f78d1cac6c47d49dc908d890aadbdb|72f988bf86f141af91ab2d7cd011db47|1|0|637418410796504087|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|1000&sdata=Qu2G2oUZdi5nJnu3%2BwTlGD%2FcmrpG8duuAwGR3ub5XsU%3D&reserved=0.
Hi @wanlwanl,
Is the ack also added in .NET core version of SignalR?