I get kicked out of my app at random times

Hi there,

lately I’ve been having the problem that my users randomly get kicked out of my app. This can happen any time while using the app and is not connected to any user action.

I tried it a few times by just letting it sit in the background - sometimes you get kicked out after a few seconds, sometimes you get to use it for 30 minutes or longer, but you always get kicked at some point.

The logs show that Streamlit seems to pull the code from GitHub and restart the app at random times even though no changes have been committed to the repository.
Besides a commit to the repo, what triggers an update of the code in Streamlit?

Here’s an example of the log. The first two entries are expected outputs of my app. I didn’t touch the app or uploaded anything to GitHub. After a while I get kicked out and the log show the cloning of the repo and the restart of the app.

2022-07-27 06:33:06.853 Processing request DwdObservationRequest(parameter=[(v_n/cloudiness)], resolution=hourly, period=[None], start_date=2020-01-01 00:00:00+01:00, end_date=2020-12-31 23:59:00+01:00, humanize=True, tidy=True, si_units=False)
2022-07-27 06:33:06.897 Processing request DwdObservationRequest(parameter=[(v_te100/soil_temperature)], resolution=hourly, period=[None], start_date=2020-01-01 00:00:00+01:00, end_date=2020-12-31 23:59:00+01:00, humanize=True, tidy=True, si_units=False)
[06:29:12] πŸš€ Starting up repository: 'grafische_datenauswertung', branch: 'master', main module: 'πŸ”‘_login.py'
[06:29:12] πŸ™ Cloning repository...
[06:29:22] πŸ™ Cloning into '/app/grafische_datenauswertung'...
[06:29:22] πŸ™ Cloned repository!
[06:29:22] πŸ™ Pulling code changes from Github...
[06:29:23] πŸ“¦ Processing dependencies...
──────────────────────────────────────── pip ───────────────────────────────────────────
Collecting deta==1.1.0
  Downloading deta-1.1.0-py3-none-any.whl (8.7 kB)
[...]

I hope someone can help me, because I have no clue how to fix this.

If you want, you can try it out yourself:
https://lasinludwig-grafische-datenauswertung--login-q6hdg2.streamlitapp.com/

username: guest
password: guest2207
1 Like

I am having the same issue… the browser refreshes the page at random times and my users are kicked out and the session state is reset

3 with the same situation. Yesterday I was using my app and I had the same problem. The page was refreshing in periods of less than 5 minutes and the session state was resset too. Luckily I had implemented URL parameters, so I was able to go back to get the state again.

Hi fhtsibuya,

what are URL parameters? Could you tell me a little bit about how that works and how you use them to get your state back (or a link to the docs - I couldn’t find it)? It sounds interesting.

Hi @lasinludwig,

You can use URL parameters to share and save the state of your application/options. Parameters stays in your browser history and is easy to share the options.

If the URL of your application is site.com/?id=123, you can get the id information and set in id option directly as 123.

You can use st.experimental_get_query_params to get the parameters of the URL and st.experimental_set_query_params to pass the data to the URL.

Some useful links that helped me to use this feature:

2 Likes

I’m also having the same issue. My team is preparing to give presentations on our app and it was making the app literally unusable for other members of the team. Oddly enough, I didn’t have the same issues, even accessing the same app in the same way. I suspect that Streamlit isn’t doing a good enough job testing multi-user scenarios.

Hi @lasinludwig @tommaso-moro @tyrin @fhtsibuya

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

1 Like

Thank you! I’m so glad to hear this.

Thank you! This is super helpful

Hi @Charly_Wargnier ,

thank you for your reply. Unfortunately I’m still having the issue (same randomness, same log entries…)
I am using the latest streamlit version btw (1.11.1).

Do you have any other ideas, what the problem might be?

1 Like

Thank you very much @fhtsibuya ! It sounds very interesting.

2 Likes

Thanks for the heads up @lasinludwig! I’ll liaise with our devs and find out what may be happening.

Best,
Charly

Hi @lasinludwig,

Here’s the feedback I’ve got from Devs

there is a possibility that users get kicked out of the apps in the following situations:

  • daily, we are moving some apps around to optimize a bit the resource usage
  • sometimes, we are migrating apps from old nodes to new nodes for security reasons (e.g. update version of the node which contains a newer Kernel version)

Since today I migrated all apps to new nodes, there is a chance that the user got migrated in the last 2 hours so he saw that. Moving forward, we are not planning any other migrations in the next 30 days, so the use shouldn’t experience this anymore.

I hope this helps you, but please let us know if not. We’ll be happy to help further :slight_smile:

Best wishes,
Charly