KOOKIIEStudios / PalCON-Discord

A Python-based Discord bot for PalWorld server administration via RCON
MIT License
18 stars 3 forks source link

[Unable to fetch/send metadata of connected players: list index out of range] #9

Closed liam6080 closed 7 months ago

liam6080 commented 7 months ago

Every so often in the discord server it will throw the error: Unable to process your request

The console error: 2024-02-01 20:04:17,373 - client - INFO - Setting up RCON connection 2024-02-01 20:04:17,373 - client - DEBUG - Fetching online players 2024-02-01 20:04:17,417 - main - ERROR - Unable to fetch/send metadata of connected players: list index out of range

It does get a little annoying as we rely on this to work all the time, I love the thing you have made :) I would at least like to know why this happens and if this can be fixed/When it will be fixed?

This was working before and I have not touched the configs, It just seems to happen from time to time.

Bratah123 commented 7 months ago

Interesting thanks! I do have some seldom knowledge related to this but idk if its true, PalWorld RCON requests for GetPlayers seems to be a bit buggy when used too often AFAIK (not sure if its fixed in v1.4.0) and I don't know if it's related to this issue at all.

Seems like another person https://github.com/KOOKIIEStudios/PalCON-Discord/issues/7#issuecomment-1921924538 also is having the same problem as you.

If you could provide some of this information it would help us get down to the bottom of this:

Currently it's difficult for me to reproduce so all these questions will help me try and get this error myself, Thank you!

Bratah123 commented 7 months ago

I pushed a possible fix for this issue in: baf0b93dd9fc215f6223917b34e4a555e630e775

Turns out it might be from our side making assumptions about the data PalWorld sends us. I couldn't reproduce the error naturally, so this was tested using intentionally modifying the information.

LMK if this fixes it after you update the bot!

liam6080 commented 7 months ago

Hello,

Q1: What operating system is the PalWorld server and Discord Bot hosted on?

A: Ubuntu.

Q2: Are they on the same machine?

A: Yes.

Q3: How many players are present in your server at the time that the command was called?

A: This has happened with 12 players on, But it has done it before with less players.

Extra add on: Also I would like to let you know that even tho it was failing, rebooting it didn't fix it, Something I noticed was that with another Rcon running on a different Ubuntu OS/IP on the same machine (As a CT), I was able to still pull the showplayers command via Rcon, Something I do notice is after X time it will re force me to run the command to connect to Rcon on this on I was using before I got this discord bot one. (I am unsure if palworld kills the connection or it's the Rcon program I am using on the second OS).

Q4: How often is the command called?

A:I can call it as many times as I want in a row without an issue, It just seems to error or time out after awhile.

Thanks, Liam. I hope this helps some how & Give you some testing you can do 😃.

liam6080 commented 7 months ago

I pushed a possible fix for this issue in: baf0b93dd9fc215f6223917b34e4a555e630e775

Turns out it might be from our side making assumptions about the data PalWorld sends us. I couldn't reproduce the error naturally, so this was tested using intentionally modifying the information.

LMK if this fixes it after you update the bot!

I just did a reboot & It updated. It looks to be working so far, I will keep an eye out & Let you know if I have any more issues, Thanks 😃.

liam6080 commented 7 months ago

Now there is an issue where it's only showing 3 people online, When there is 9 on currently. The latest update just broke something. Just to let you know 😃.

Bratah123 commented 7 months ago

Thanks, I think that narrows it down for us actually. Does one of the player's name have spaces in it? Or does someone have a comma in their name?

It actually seems our parsing logic did not cover for this edge case

liam6080 commented 7 months ago

Thanks, I think that narrows it down for us actually. Does one of the player's name have spaces in it? Or does someone have a comma in their name?

It actually seems our parsing logic did not cover for this edge case

There is a person with that has a Person 1: Normal Person 2: Twitch.tv/NameNameM8 Person 3: Normal Person 4: Normal Person 5: Normal Person 6: Normal Anything beyond this I can't answer as I don't have player names in front of me unfortunately.

Bratah123 commented 7 months ago

Thanks, I think that narrows it down for us actually. Does one of the player's name have spaces in it? Or does someone have a comma in their name? It actually seems our parsing logic did not cover for this edge case

There is a person with that has a Person 1: Normal Person 2: Twitch.tv/NameNameM8 Person 3: Normal Person 4: Normal Person 5: Normal Person 6: Normal Anything beyond this I can't answer as I don't have player names in front of me unfortunately.

Gotcha thanks, I'll try to get this promptly fixed

Bratah123 commented 7 months ago

I hate to ping you on this issue once more, but I just pushed a commit: c0f085a542b7490000e84c771a9ad9d269f482d2

That MIGHT help us figure out what is happening.. If it fixes it that's great as well!

I still cannot reproduce the error naturally, so I used test cases with the names you provided me and some names with commas. This may be caused by the command's embed itself as well, which if this commit does not fix the issue then I'll check that after.

Do let me know what you see in the command logs if you get around to testing it.

Thanks so much for your help on debugging

EDIT: I just realized, that it might be possible for someone to play palworld without a steamID ? and that the command may be skipping those players. I will need further confirmation

liam6080 commented 7 months ago

I don't mind being pinged. Also now it just shows 0 players online. Also do you have a discord server or something I can work with you in to get this sorted, Plus I had another request we need in our server to.

Bratah123 commented 7 months ago

Yes! Feel free to add me on discord, my discord is: newhashmap

liam6080 commented 7 months ago

Yes! Feel free to add me on discord, my discord is: newhashmap

Added.

liam6080 commented 7 months ago

Yes! Feel free to add me on discord, my discord is: newhashmap

Mine is: liam6080

Bratah123 commented 7 months ago

Issue has not arisen since latest build, closing issue