Closed Scrxtchy closed 6 months ago
Interesting. I'm curious if this has to do with #1657.
I didn't start observing this at 3.12.3 but rather just after upgrading to an unknown version of 3.12, so I have not considered the changes to enum values being too relevant. My speculation in the past has been the cache as my thought was "this runs fine on first run, but what if running it the second time is the isssue" but I haven't taken the time to look at that yet. But given the unresponsive nature of the program, I've been trying to understand the event loop more.
Managed to replicate this on 3.12.3. It's actually far easier to just use await bot.ws.reconnect(resume=False)
(technically, using no arguments would be fine, but this highlights how important it is) to trigger it.
Thanks, this has helped cut the time down a lot. I was actively looking at this again when I noticed the update to the thread what I've found that the problematic line seems to be in here https://github.com/interactions-py/interactions.py/blob/1a7de56b2085bdd62be77bfbb0f12506982d0858/interactions/api/events/processors/guild_events.py#L38-L42
specifically, the set()
function.
as putting a return on line 40 does not reproduce the issue, but one on line 42 will.
But I have to reconnect not once, but twice for it to happen
Found the exact issue. I'll detail it in a bit in a PR to fix it, but in short, I genuinely have no idea how reconnects were functioning up until now.
See #1663 for a fix.
Library Version
userapps @ 73c73fd
Describe the Bug
Since upgrading to python 3.12, I've witnessed an error regarding one of my apps increasing in memory usage in the early hours of the morning. In the midst of debugging another issue, attaching the logger pointed it to an issue where a long running web request is halting the main thread causing the bot to disconnect from the gateway. Upon reconnection, it goes through it's normal operation of dispatching
raw_guild_create
events, however it is only able to complete one event before hanging, when it is expected to do 7 events when compared to initial startup.if I put a return statement at the beginning of the
_on_raw_guild_create
function, the issue is not replicated.Steps to Reproduce
Expected Results
Events should be dispatched as normal without issue
Minimal Reproducible Code
Traceback
No traceback, debug logs;
Checklist
Additional Information
in trying to reproduce this in another bot, it didn't log the event I believed to have issues, instead there's nothing printed after the websocket_ready function, and the resident ram of this process was observed to be increasing, so there's a chance I'm climbing the wrong tree here