Refresh does not update app on 1.23.0 and above


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

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

  1. Deploy streamlit app
  2. Change source file
  3. Refresh

Expected behavior:
The app should reflect the changes.

Actual behavior:
The app does not update. There are no errors.

Debug info

  • Streamlit version: 1.23.0 to 1.26.0
  • Python version: 3.8
1 Like

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. :slight_smile:

1 Like

Have you tried this approach on this similar post?

1 Like

I have. It did not work.

1 Like

@kmcgrady Using the custom wheel that removes caching fixes the issue. Is there a way to disable this caching?

1 Like

Hey @passcaper ,

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.

1 Like

Thanks for the quick reply @kmcgrady!

Setting server.fileWatcherType = "poll" fixed the issue!
streamlit run --server.fileWatcherType="poll"

Out of curiosity, how often does Streamlit poll the files for changes? Is the decrease in performance significant enough to worry about?

1 Like

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.

1 Like

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.

1 Like

Maybe related:


@kmcgrady server.fileWatcherType = "poll" stopped working with the latest versions of Streamlit because of this change - streamlit/lib/streamlit/watcher/ at develop · streamlit/streamlit · GitHub
NFS caches the modification time file attribute, so Streamlit doesn’t update even though the file contents have changed. I’ve verified that Streamlit works as expected when I remove that condition.

Would it be possible to add a configuration to disable that modification check? Or to add support for PollingObserver that @Goyo linked above?


Hey @passcaper!

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?

1 Like

Hey @passcaper!

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 added PR (please check the wheel file here [WIP] File Watcher policy · streamlit/streamlit@76dea86 · GitHub (Artifacts at the bottom of the page). It adds a new config option server.fileWatcherPolicy.

Could you please verify on your setup that if you set server.fileWatcherPolicy="always" it works as expected with NFS with polling watcher?

1 Like

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]):

  1. fileWatcherPolicy=“always” [did not work]
  2. fileWatcherType = “watchdog” [did not work - confirmed that Watchdog 4.0 is installed]
  3. fileWatcherType = “poll” [did not work]
  4. enableCORS = false [did not work]
  5. 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.

I have not yet tried installing the custom Python Wheel file solution (as described in the forum here: Re-Run/Refresh does not update page anymore on 1.24.0, need restart of Streamlit for update to happen - #13 by kmcgrady)

I’ll still continue to look for solutions but wondered if anyone has had success with this problem, on a recent version of Streamlit?

Many thanks in advance.

1 Like

@kajarenc Sorry. I did not see this message. Will try this out and let you know. Thanks for looking into this.

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

Sorry again about the delay.