Refreshing does not update the app on 1.23.0 and above. It was working fine on 1.22.0 and below.
I am deploying a Streamlit app in Kubernetes with the source file on a mounted NFS share. When I update the source file from another client with the mounted NFS share, the file updates on disk, but refreshing the app does not update the content. However, if I update the file directly from the app server, the content is updated.
I’ve tried 1.23.0 to 1.26.0 with no luck. Downgrading to 1.22.0 fixes the issue. I am using default Streamlit configurations.
Were there changes to how Streamlit watches files for changes that may have broken this behavior?
Steps to reproduce
Code snippet:
import streamlit as st
st.write("test")
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Deploy streamlit app
Change source file
Refresh
Expected behavior:
The app should reflect the changes.
Actual behavior:
The app does not update. There are no errors.
Thanks for raising this issue. I had noticed the same thing myself and hadn’t had a chance to sit down and find the specific conditions. I’ve raised the issue with the Community Cloud team and will take a further look at this myself when I get I chance. I’ll update this thread if I hear anything. Oops, this wasn’t for Community Cloud, but it could be there is some underlying issue that connects the two, so I’ll still take a look.
Could you try setting the configuration server.fileWatcherType = "poll" to see if it is works for your use case? If not, can you try server.fileWatcherType = "watchdog" (you may need to install it directly)
The caching is used to optimize for performance, which is good, but it relies on the file watcher to work properly. Can we verify whether polling or watchdog is failing? From the previous discussion, it seems like Watchdog is not properly working, so it will be worthwhile to reach out to them.
I believe we check the file every 0.2s based on this implementation. I would assume it would not be a big deal if the number of files is overall small. We do this checking in a thread so it’s not meant to impact the rest of the app.
I’m curious to find out why Watchdog isn’t working properly here. I wonder if there’s a Streamlit bug for watchdog or if there’s a bug in Watchdog itself.
Seems like an NFS specific issue since it doesn’t happen if the file is updated directly on the app server. I’m happy to try to debug it if you have any suggestions.
I’m looking at this problem, next week I may have some questions/ask for details to verify that the solution works on your setup
Just to double-check, your hypothesis is that removing modification_time != 0.0 from if expression if modification_time != 0.0 and modification_time <= self._modification_time:
solves problem with poll file watcher for your setup?
After thinking about this a little bit more I came to the conclusion that most probably you meant the whole if statement. In particular, if NFS caches the modification time, we will go inside that if statement and will not handle the event.
The solution that could work best here I think is parametrizing PollFileWatcher, to make it configurable whether it should rely or not to modification time.
I would just like to highlight this issue, once again. The automatic refresh (even a manual refresh) is not updating my Python source code changes. Only restarting the server/app with ‘streamlit run…’ updates the changes. I have tried the following solutions, without any success:
I have streamlit version 1.33.0 installed on Mac OS Sonoma 14.4.1, using VS Code as my IDE and Python 3.11.0 in my venv. Trying to revert to streamlit 1.22 did not work for me.
Adding to the config.toml file (under [server]):
fileWatcherPolicy=“always” [did not work]
fileWatcherType = “watchdog” [did not work - confirmed that Watchdog 4.0 is installed]
fileWatcherType = “poll” [did not work]
enableCORS = false [did not work]
enableXsrfProtection = false [did not work]
I also tried using a private window (or Incognito mode) in Safari. This did not work. Emptying the cache for Safari did not work. Using Firefox did not work. Uninstalling and reinstalling Streamlit did not work.
@kajarenc Tested your PR by installing the wheel and it works! We were removing that entire if statement as a workaround until now. It would be great to get this merged so we can remove this workaround on our end.