What exactly is ScriptRunContext?

Okay, this is getting low-key annoying. I figured out what’s causing the memory in my server to grow: it’s the fact the main thread never exits. I’m using some multi-threading on my streamlit app and every time I run it, I get a warning as follows:

Thread 'Thread-73 (get_links)': missing ScriptRunContext 

I’ve discovered that every time the script is executed, my threads from the last execution aren’t finished and keep raising the memory. I’m suspecting it’s related to the missing ScriptRunContext error since there are literally no other errors or warnings in my code. I’ve seen a few links like these but not sure how exactly to resolve this issue. Would appreciate some info.