I’m trying to understand the expectations around Streamlit rerunning the script in reaction to new user input. For instance, when the script is rerun because the user changes the selection is a selectbox.
A lot of the times when a user does this (while the script is still running), the app will lock up and no longer complete running or respond to new user input. A total page refresh is necessary to recover.
Potentially of note, my app spawns several processes (via multiprocessing.pool.Pool) that initiate sometimes longish (10s - 2m) queries on external databases.
When my app locks up and stop responding in this situation, I typically see Streamlit print “Stopping…” to the console where I started Streamlit. When I press CTRL+C in the same console, i just get more printing of “Stopping…” and I eventually have to manually kill the original Streamlit process and it’s children.
Is there something my script should do to respond to the fact Streamlit is restarting the script? is there a signal my script can respond to and cancel all these queries and such?