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
[BUG] Discord bot occasionally creates two portal sessions #3077
Comments
Not just 2 sessions, it keeps going: |
It doesn't appear to be limited to when reloading/restarting the game at all: Accounts: |
Here's the portal log where it appears the portal didn't drop the connection properly. Hope this helps!! |Portal| 2023-01-16 11:55:11 [..] Discord connection lost. |
@Antrare can you share your version info? |
Also, if you can find or track any information on the situation where a new session is created that would be really helpful. |
This is server log at same period, I'm not sure where else to get you the info you're asking for? It's interesting that the server knows there is more than enough sessions, could possibly check for that when reconnecting as well? I'm not going to get a chance to get back into coding for another week or so to have a go myself. 2023-01-16 11:38:36 [..] Logged out: DiscordBot(account 15) discord.gg (0 sessions(s) remaining) |
Just to add, there was nothing going on with the Discord channel (no messages at either end), no user activity and best I can tell there were no network dropouts/issues (as my telnet session to the server remained online throughout). |
logged on today with no discord activity messages on either end, and we may have @reloaded once or twice but not... alot. Came on to almost 20 discord bots connected https://pastebin.com/EDwBpC7g |
ALL RIGHT, I think I may finally have some useful information for this. I rebooted my server a couple days ago to start from a clean slate on bot sessions and pulled out all the rest of my portal logging code so it's just errors and the Discord bot. I currently have 3 sessions, which means an extra of two. In my logs, I have a lot of the standard "received reconnect opcode" disconnect/reconnects, but I also have two instances of the connection simply being lost. My current tentative hypothesis is that the sessions aren't being closed properly when the connection is lost (as opposed to closed). Then, since the bot then creates a new session that re-establishes the remote connection, the "disconnected" ghost sessions can and do still communicate with the remote server, resulting in multiple active sessions. I'll dig around into this over the next few days and see if I can find anywhere in the code that looks like it might be failing to clean up sessions. |
I said "the next few days" but I am pretty sure I just found it. I'll test it for a couple days before I put in a PR but I think this will be an easy patch. |
Describe the bug
Sometimes when starting up or reloading a game, the Discord bot appears to create two portal sessions instead of one. A reboot of the game (the restart which stops and restarts the portal as well) corrects the issue.
It's not entirely clear what conditions cause this yet, so I am opening this issue to collect additional information to track down the problem.
Environment, Evennia version, OS etc
Debian, evennia 1.0.2
The text was updated successfully, but these errors were encountered: