Streamlit app keeps auto refreshing after around 30 minutes when hosted with streamlit cloud

When launching our app via streamlit cloud we seem to experience an annoying bug. The site automatically refreshes somewhere between 15-30 minutes. This is a serious problem for us as we are trying to create a platform that is used for collecting data and doing some statistics on the users. (This is only done on voluntary users! We are doing a research project testing out ways to improve learning rates). Now when the page automatically refresh we lose all the states and information of the user(they are anonymous and seperated by a randomly generated id upon launch) and it goes back to square one as if the user just opened the application on their browser.

I can’t seem to find a way to work around this and there seems to have been a lot of people having trouble with this in the past, yet all i can find is some devs saying it was a bug in 1.9 and 1.10 and that it is now solved. I am not entirely sure of what version streamlit cloud launches in or how to check it, but locally we all have streamlit 1.16 .

I have been to a few different drafts trying to find a solution for me and my groups problem

Cancel auto-refresh app in the cloud - :cloud: Streamlit Community Cloud - Streamlit

I get kicked out of my app at random times - :cloud: Streamlit Community Cloud - Streamlit

Streamlit Cloud apps refreshes automatically - :cloud: Streamlit Community Cloud - Streamlit

Are you specifying a version of Streamlit for your deployed app?

No we do not. However we do not see which version we should specify it to as we have seen many other people reporting the same issue with versions up to 1.20

Hello! I’m experiencing a similar issue too. My Streamlit Cloud App is supposed to process some data from Google Drive and upload them back, showing the progress through a bar. At the end, the app should print overall statistics and upload them as well. What happens is that on average after ~30 minutes, the frontend refreshes automatically (and the bar disappears), while the backend continues to run. At the end, I have the all the files are still correctly processed and uploaded, but the final output summary is not printed, nor uploaded because of this.

if it is any help, we solved the problem by storing all our session states in a data base regularly (obviously overriding old ones to save space), and then we make the program load the stored session upon start up

Oh ok, thank you very much! So there’s currently no solution to keep the current session up and running til the backend is done with the computation

This has been an issue that I’ve seen come up a lot and I’m still a little fuzzy on the details myself. However, I’ve heard that having a file uploader on the page may exacerbate the issue (or possibly be one of the root causes). So, this is a wild shot in the dark, but…

If you happen to have a page with a file uploader that’s the one resetting on you…can you shuffle the file to session state so that you can go to a different page to perform that long process. My hypothesis is that reducing the complexity of what Streamlit is trying to “keep active” (widgets) while performing the longer process may help.