Has anyone else noticed that streamlit appears to have a few strange and subtle bugs? I’ve noticed a couple oddities:
Sometimes streamlit reloads unexpectedly and all multi-select widgets are reset to their default values. However, based on what code runs, the values returned by the widgets still seem to be the old values for the first such run of the app. Then the next time the user modifies a widget’s value the default values of the multi-select widgets end up being used instead.
Sometimes an entire streamlit app crashes unexpectedly and the page needs to be refreshed. This can happen either when entering input or while waiting for code to rerun. It’s probably not related, but I’ve become wary of scrolling up and down the page and interacting with already-plotted alt-air charts while waiting for code to run because it sometimes appears to induce these crashes.
I would try to create a minimal working example of these, but I’m not really sure how to reproduce these bugs – they only happen some of the time when I run my app.
Has anyone else experienced similar issues? They seem to occur infrequently enough that they are more of an annoyance than a problem for my purposes, but they are still frustrating to have to deal with.
Streamlit does a rerun everytime that is some change either in the script or a change made by the user within the App. There are some cases that you could need to store the state between reruns you could solve that using st.cache or “Session State” like is shown in this discussion
We are going to be needing an example to try it out
Yep, I know. that’s not the kind of rerun that I’m referring to. I’m talking about reruns that occasionally happen outside of those two cases.
Fair enough. Unfortunately, as I said, I am unable to reliably reproduce either of these two bugs. They appear to happen at random as far as I can tell.
Unfortunately your answer was no help. However, I know I didn’t give you much to work with, so I didn’t expect a solution. I’m mostly curious to know if others have encountered similar issues.
You’re encountering this behavior because streamlit won’t re-import everything when you re-run your script.py, thus your code.py's body won’t be re-executed. By wrapping everything in a function like you said, you can explicitly call it in script.py to execute everything.
@Yasha, is this what you are talking about? Notice here in below gif, I am selecting No for both the radio buttons and then suddenly the page reloads and the values are reset to default Yes again. I don’t know how to tackle this! Maybe I am doing something wrong or I am missing something.
Also this happens only like 6 out of 10 times or so, not always!
I have encountered the same issue several times, particularly if there are a lot of user inputs.
My version is 0.71.0. Unfortunately, I cannot share the source code and it is not possible to reliable reproduce the error since it is unpredictable. However, my error is basically the same error Benison_Sam presented via gif.
Example: My app has “Main Page” and a few other “pages” which are not related to each other (each page contains code and functions which are ran only on that page). After I complete some task on “Page 1” and go to “Page 2” to complete some other tasks, sometimes the whole app refreshes after I click a button or upload a file and it returns me to “Main Page”. When I go back to “Page 2” I can see that the files are uploaded, but I have no idea why it returned me to “Main Page”.
P.S. Different pages were handled via st.selectbox()
Something similar to what @Benison_Sam has illustrated happens. Sometimes my application, when running cross-validation computations, will suddenly stop and reset everything. I am using version 0.72.0.
I cannot share the source code and, like the others have stated, this is something that only happens sometimes thus it is hard to reproduce the error.
Those refreshes can be a real Streamlit bug, or some code flow issue in your apps.
Unfortunately with no code sample, It’s going to be hard to identify what’s the matter.
I have added a snippet of my original code to this repo with instructions under the README.md file on how to try to reproduce this strange behaviour. Then again, it might be hard to do reproduce it as it presents a somewhat random nature, but I have noticed, on my specific application, that it is more common when the Yearly seasonality parameter is set to True.
After pressing the Validate button the app will appear to be running smoothly for a few iterations of the process and then, all of a sudden, the text on the top right-corner will change from RUNNING… to CONNECTING… (see images below) and the app will completely reset.
Hi @ruimaia!
I was going over your issue and I think I have a similar one. I have an app that does a heavy computation, when clicking a button called “submit”, in the background and Streamlit seems to work at the beginning just fine. This computation has an extra step that takes around 30 mins to complete (or more) that can be enabled by clicking on checkbox (disabled by default). While that checkbox is set as False, Streamlit runs the computation and shows the results correctly (I haven’t had any weird reload issues here). Now, when the checkbox is set as True, the first part of the computation is made but then suddenly Streamlit reloads and goes back to the original main page as if nothing has happened. In my case, the state of “Running” doesn’t change to “Connecting”, it just reloads and goes back to the original, but I think it is indeed related with certain components as checkboxes or selectboxes.
Hey anyone new info on this random bug? I’m also experiencing this without being able to pinpoint the random full refresh behavior, the full reset appears to be completely random
let me support with my case, i use streamlit form that when user input something and submit, it will load and display images. After all images are load and display successfully, it keeps images showing perfectly. however after a random time, it refresh and all displaying images are gone. user has to start all over again to see images. Still figuring out how to fix this.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.