Cancel auto-refresh app in the cloud

Hi all,

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) ?

Thank you very much

2 Likes

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?

1 Like

Same here. Sometimes I get kicked out right away, sometimes after a few minutesā€¦ the logs look like itā€™s updating the code from GitHub every so often even if there are no changes.

I put up a post about this yesterday. So far no solutions:

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.

1 Like

@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!

1 Like

@lukasmasuch I have updated streamlit to 1.11.1 but the issue persistsā€¦

Hi @tommaso-moro @giddyphysicist @Julitocast

Sorry to hear youā€™ve experienced that issue, and thanks for reporting it :pray:

The issue seemed to be caused by a bug invalidating the anonymous usersā€™ sessions whenever someone disconnected Github from their account.

That bug was fixed today and released, so users should not encounter the issue anymore, yet please let us know if youā€™re still experiencing it.

Happy Streamlit-ing! :balloon:

Charly

3 Likes

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.

Iā€™m on v.1.14.1 and my users keep reporting this random refresh issue on Streamlit Cloud. This is a serious bug that needs to be fully rectified.

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
[server]
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:

1 Like

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:

spec:template:metadata:name

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.

1 Like

Same here. Streamlit v1.15.2.

same here streamlit 1.17 also locally but only on firefox

same here in 1.17 in chrome

Same problem here. Any workarounds or permanent fixes? I have a web app which can run for a long time I donā€™t want the webpage to refresh until the job is done :frowning:

I have the same issue (1.19.0, Streamlit Cloud). Link to my app is here.

Hi @ikarimov, @gustavz, @ranibaron,

Iā€™m just checking in to see whether youā€™re still experiencing the issue.

If the issue persists, could you please provide us with access to a public app where we can attempt to replicate the problem?

Best wishes,
Charly

Still face this issue at www.ailyze.com

1 Like