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

Discord, duplicating clan channels at reboot #436

Open
TomLewis opened this issue Aug 5, 2024 · 9 comments
Open

Discord, duplicating clan channels at reboot #436

TomLewis opened this issue Aug 5, 2024 · 9 comments
Labels
bug Something isn't working

Comments

@TomLewis
Copy link
Contributor

TomLewis commented Aug 5, 2024

Describe the bug
I had this bug previously, #434
And it was disagnosed as Clan channels duplicating along with simpleclans needing to be the latest dev build.

After reboot yesterday, SimeplClans randomly decided to create a bunch of duplicates for a clan "ee", nothing has changed on the server or discord, it just decided to do it at reboot.

Theres a bug somewhere thats duplicating channels, and in this case its created 3 all at once for one clan, this in turn breaks ALL of the discod chat for every single clan, not just this clan.

Can we please get some logic thats checking for existing channels, there must be some sort of API issue with discord that happens randomly, and then you tell it to make new channels over and over until it can check it exists, and then theres 3 or 4 etc.

image

To Reproduce
Steps to reproduce the behavior:

  1. Reboot the server

Expected behavior
To not do this

Software (please complete the following information):

  • Server: Purpur 1.18.2
  • Plugin version 427
@TomLewis TomLewis added the bug Something isn't working label Aug 5, 2024
@Tomut0
Copy link
Collaborator

Tomut0 commented Aug 5, 2024

Can I ask you to enable SimpleClans' debug and try to reproduce your issue?
SimpleClans should throw an error in console when there are duplicated channels appears at server boot.

@RoinujNosde
Copy link
Owner

Are you running SimpleClans in 3 servers? All connected to the same Discord server?

@TomLewis
Copy link
Contributor Author

TomLewis commented Aug 6, 2024

Are you running SimpleClans in 3 servers? All connected to the same Discord server?

Nope, just 1 server.

Can I ask you to enable SimpleClans' debug and try to reproduce your issue?

Yeah sure, its already on from the last issue! haha

https://gist.github.com/TomLewis/bddcda8ec67c035aa4457b134f1b3153

And boot https://gist.github.com/TomLewis/7036d0a2b38d318fa595dd1488a675db

@Tomut0
Copy link
Collaborator

Tomut0 commented Aug 6, 2024

You told us those discord channels were created on boot,
However, I am sure they were created earlier. It follows from the error exception you sent us:

java.lang.IllegalStateException: Duplicate key ee (attempted merging values <#1092075569082015764> and <#1269260858488389694>)

Which means SimpleClans somehow passed through 2 layers of protection:
1 Layer: It removes already used discord channels from the creation.
2 Layer: It actually does checking on channel existence before the creation.

I am going to add some more debug messages to this process at #437.

@TomLewis
Copy link
Contributor Author

TomLewis commented Aug 8, 2024

Weird! Sounds good to me, If you add debug messages at boot at every stage to output to console, then I can wait for my reboot and see what its checking for what and I can report back, then we can see if its doing things at the right time!

Does it cache these channels from discord or is it doing a fresh check each reboot? Because these discord channels shouldnt ever be touched outside of this plugin by anything or anyone, silly question but shouldnt each discord channel have an ID thats unique? then each clan can just have that as their discord channel ID, and not its name being unique, that solves the bug where if there is another channel created its not going to fully break.

I just dont know how you solve bad API calls back from discord, if they are temp down, or if theres some sort of issue in the pipeline if its checking for a channel to see if it exists already and keeps trying..

@Tomut0
Copy link
Collaborator

Tomut0 commented Aug 8, 2024

clan can just have that as their discord channel ID, and not its name being unique

It was made on purpose. Storing Clan <-> Discord ID in a separated file or in config.yaml is an unnecessary I/O task.

how you solve bad API calls back from discord, if they are temp down

It actually doesn't happen much, but even so, simple server restart should fix any troubles.

@Tomut0
Copy link
Collaborator

Tomut0 commented Aug 8, 2024

@TomLewis It was just merged, can you try it?
It was uploaded on Jenkins.

@TomLewis
Copy link
Contributor Author

Sorry, I completely forgot about this.

So I just noticed today, I have 6 new channels for the Crew "EE"
image

So I wondered, if its always EE why not see if a crew leader is running the command.

Looked on my coreprotect web UI and, low and behold a crew leader for EE is spamming the command, ignore their username, the coreprotect web UI is ancient and displays old usernames.

image

They used it 7 times, but when I look at my log, there is no simpleclans feedback on what its doing.

[10:36:39] [Server thread/INFO]: Tulipss issued server command: /crew discord create
[10:36:39] [Server thread/INFO]: [Matrix] (Via) Player Exoticial joined with (1.21.X/767) client
[10:36:41] [Server thread/INFO]: Tulipss issued server command: /crew discord create
[10:36:42] [Async Chat Thread - #1/INFO]: *--------- Rule match (chat) for Nick_A_Naut --------- 
[10:36:42] [Async Chat Thread - #1/INFO]: MATCH: \bwb\b
[10:36:42] [Async Chat Thread - #1/INFO]: CATCH: wb
[10:36:42] [Async Chat Thread - #1/INFO]: UPDATE: welcome back
[10:36:42] [Async Chat Thread - #1/INFO]: [global] Nick_A_Naut: welcome back
[10:36:42] [Async Chat Thread - #1/INFO]: [global] Dim30: I am back
[10:36:42] [Server thread/INFO]: Tulipss issued server command: /crew discord create
[10:36:43] [Server thread/INFO]: Tulipss issued server command: /crew discord create

so now, im thinking, maybe its stuck somewhere doing a check when they run the command, its also suppose to charge them to do this, but I can't see any logs that that, happened either.

Im going to ask the player why they did this and what feedback they had from the plugin, otherwise im in the dark with no logs in the console.

but thought I would update as this popped out to me today!

I will get that jenkins build added now for tomorrows reboot.

@Tomut0
Copy link
Collaborator

Tomut0 commented Aug 16, 2024

if you have enabled show-debug-info in SimpleClans config and use the latest development build (from Jenkins).
You should see something like this after command execution:

[23:52:23 INFO]: Tomut0 issued server command: /clan discord create
[23:52:23 INFO]: [SimpleClans] [51] Creating a discord text channel for test clan
[23:52:23 INFO]: [SimpleClans] Added view permission to null (194521791824265216) discord member
[23:52:23 INFO]: [SimpleClans] Added leader role to null (194521791824265216) discord member

However, if the clan was already created, it will return nothing to the console.

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

No branches or pull requests

3 participants