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

Duplicate categories are created if new members are assigned to channels and channels are assigned to categories #120

Open
christianhueserhzdr opened this issue Aug 4, 2023 · 8 comments · May be fixed by #124
Labels
Type/Bug Something isn't working

Comments

@christianhueserhzdr
Copy link

christianhueserhzdr commented Aug 4, 2023

The automatic assignment of new team members to channels and the triggered automatic assignment of this channels to the new member's categories creates duplicate categories.

I assume that the assignment of members to channels triggers the assignment of channels to categories. If this member to channel assignments are not finished when the channel to category assignments start there will be duplicate categories because when the check occurs if the category is already present or needs to be created there are several triggered channel to category assignments which all think that no category has yet been created, thus they all create duplicate categories. Which is an issue of concurrency.

I would suggest

  1. to not trigger the channel to category assignments before all the member to channel assignments are done, or
  2. to resolve this issue of concurrency adequately.

Please let me know if this an issue that the Mattermost server can only deal with and I create an issue there.

Thank you very much for looking into this issue and for your valuable feedback! 🙂

@christianhueserhzdr
Copy link
Author

Is there any update on this issue?

@christianhueserhzdr
Copy link
Author

Do you need any additional information about this issue from my side? Thanks for letting me know!

@mickmister
Copy link
Contributor

HI @christianhueserhzdr, thank you for filing this issue. I'm thinking we can solve this in the welcomebot plugin, by debouncing the operations of adding the user to multiple channels.

We currently do not do any "waiting" in between adding the user to different channels. If we add some wait period (~3seconds) I think that would be enough to avoid this issue. What are your thoughts on this?

Here are the two places we are doing this operation in a loop:

https://github.com/mattermost/mattermost-plugin-welcomebot/blob/502eb34dc47db99c6b0b96e630fba4ee3516ad2e/server/welcomebot.go#L201-L203

https://github.com/mattermost/mattermost-plugin-welcomebot/blob/502eb34dc47db99c6b0b96e630fba4ee3516ad2e/server/welcomebot.go#L114-L116

@mickmister
Copy link
Contributor

@raghavaggarwal2308 For context, there is a feature called "Channel Actions" in the playbooks plugin https://github.com/mattermost/mattermost-plugin-playbooks, that allows an admin to configure the channel to make it so whenever a new user joins the channel, they will have that channel added to a specific channel category.

It seems there is a race condition happening with the welcomebot and playbooks plugins, where the welcomebot plugin is adding users to the channels too quickly, so the "channel category add" process can end up creating new categories instead of using existing ones, which results in duplicate channel categories. If we slow down the welcomebot's channel member modifications to avoid this race condition, I think the issue will be avoided.

@christianhueserhzdr
Copy link
Author

Thank you very much, Michael @mickmister, for looking into this issue report and writing down your opinion on how to resolve it.

Regarding your suggestion, adding some wait period is a quick fix in some cases, but personally I do not consider waiting times to be very sustainable. This issue will recur from time to time when the waiting period has not been long enough. On the other hand, introducing a waiting period of 3 seconds or more will result in a longer processing times, if several tens of channels and multiple categories are involved as already seen in some cases.

I would very much prefer to see that these race conditions are solved, if this is possible. I can imaging that this needs to be solved on both sides, Mattermost and the plugin.

Anyhow, thank you very much for your feedback and thoughts! I am glad that someone is looking after this issue. 🙂

Please let me know how you would like to solve it. Thanks!

Christian

@mickmister
Copy link
Contributor

@christianhueserhzdr We've decided to handle this issue in both places (waiting in the plugin, and avoiding race conditions in the platform). I'm thinking the plugin fix will arrive sooner. We'll keep you updated here. Thanks @christianhueserhzdr!

@mickmister mickmister linked a pull request Feb 23, 2024 that will close this issue
@Kshitij-Katiyar Kshitij-Katiyar added the Type/Bug Something isn't working label Apr 12, 2024
@ayusht2810 ayusht2810 moved this from Backlog to Submitted / In Review in Brightscout Plugin Maintenance Apr 18, 2024
@christianhueserhzdr
Copy link
Author

Dear Michael @mickmister and Ben @hanzei, are there any plans to continue with this issue and the corresponding PR #124? Thank you very much for your effort and for letting me know!

@hanzei
Copy link
Contributor

hanzei commented Nov 4, 2024

Working on this plugin is not a priority at the moment. I don't think the PR will get traction. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type/Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants