I launched an app recently through Streamlit Cloud.
Everything looked OK at first sight, but recently, visitors from the app warned me about an automatic page refresh, triggered after several minutes of inactivity on the URL.
Did this happen to anyone?
Is there a way to block this auto-refresh (I have not seen anything in the app settings) ?
I’m seeing a similar issue. For mine, the deployed app fully auto-refreshes when the user is interacting with input widgets. The goal of my app is to allow users to vary a large number of input parameters and run a simulation, but the users are not able to enter all the parameters before the page refreshes itself. I don’t see the issue when I run locally on my machine – it seems to be an artifact of the streamlit cloud deployment. I too would like to block the auto-refresh, if it is possible. Could this be a deployment container issue?
Hmm… I tried wrapping my streamlit app in a local docker container to see if I could host it myself. In my case, it doesn’t seem like it would reach out to Github. But even when I run the local docker container, I am seeing the same issue as on the streamlit cloud with the page refreshing. In my case, when I try interacting too quickly with any of the numeric inputs (e.g., rapidly clicking an increment button), it completely refreshes the page and resets the session state. Could it be an issue with running streamlit from a linux container? I don’t seem to have any issues when I run it locally from my windows or mac machines. But running from a docker container or streamlit cloud both generate the bug.
I have the same problem! I have a lot of widgets in my app and the user often can’t even interact with all of them and press “submit” because the page refreshes at random times and the session state is reset. I have checked for memory leakage / performance issues but that does not seem to be the issue
@tommaso-moro@giddyphysicist Can you both check if you are running Streamlit version >= 1.11? If refresh is triggered by some interactions with widgets, it might be related to a widget loss issue we had in version 1.9 and 1.10.
@lukasmasuch , thank you! I had been using version 1.10. Updating to 1.11.1 seems to have fixed it for me (both locally in a docker container and on the newly released cloud version). I’m waiting to get some feedback from the app users, but for now the version update seems to have fixed it. Thanks so much!
Hello Charly, I am having the same issue. However the app is deployed in google cloud platform.
upon several research I found out that in google cloud, the app need to return a request. so basically my app keep hitting the request timeout.
Same thing here.
My app works perfect in local, but when deployed to google cloud it refreshes automatically every 1.5 to 5 minutes randomly.
This refresh deletes all the things done or selected by the user, which i think is a serious bug.
Looks like it happens in streamlit cloud and google cloud, so not a one cloud system issue.
I have try a couple of workarounds but none of them worked.
a) first workaround, set this in the config.toml file
runOnSave = true
b) second workaround: set a ping to a random server at the end of my code, with a sleep time of 5 sec. this way the app is always active and you can make sure of it as the running icons on the top right corner are moving. But didn´t work.
Also thought this could be a browser issue (browsers auto refresh tabs normally), so I took a tab in chrome to run the app, and disabled the auto refresh options of the browser. But didn´t work either.
There is another discussion with the same topic here:
I found the solution for google cloud deployed apps. Not for streamlit cloud, sorry.
FOR GOOGLE CLOUD:
In your app control panel, there is a menu with metrics,details, and YAML
YAML (short for “YAML Ain’t Markup Language”) is a human-readable data serialization format. It is often used for configuration files and can be more readable and less verbose than other formats such as JSON and XML.
In Google Cloud Run, you can use YAML files to define and configure Cloud Run services. These YAML files, called cloudbuild.yaml, are used by the Google Cloud Build service to build and deploy containers to Cloud Run.
find the timeoutSeconds spec, that should be set to 300 by default.
Enter Edit mode for this file
Change timeoutSeconds to 3000, for example. 3600 is the max allowed
Then you are asked to change also the name of the template:
in my case was energyanalyzer-00014-qel and changed to energyanalyzer-00015-qel
Save and implement again. This solves the issue.
I guess streamlit guys should change this value, as far as I know we cannot configure this param by ourselves.