Streamlit session state keeps resetting when doing actions quickly (Kubernetes deployment)

Hi! It seems that my Streamlit script keeps resetting its state when deployed on a Kubernetes cluster, but performs as expected on my local machine. This demo script shows the problem:

import time

import streamlit as st
import pandas as pd

def render_dashboard(**_kwargs):
    time.sleep(1)
    value = st.number_input("Number")
    st.write(value)


render_dashboard()

When I push the increase number button quickly Streamlit resets the state after some number of clicks (see the attached video). This does not affect the script when running locally.

Video: https://transfer.sh/j2S37c/streamlit-bug.mov

2 Likes

Very interesting… does it look like a similar issue as this?

We have also noticed very strange behavior with state resetting on heavy calculations.

1 Like

Also, we opened an issue on github: Widget Reset on heavy calculations · Issue #4836 · streamlit/streamlit · GitHub

If it feels that the issue is similar, we should probably join efforts on this.