Application ceasing updates after 8 hours (Azure App Service/Microsoft Identity provider)


I am running a number of applications deployed on azure app service. They all use Microsoft as identity provider. Some of these applications are simple dashboards that run 24/7. These dashboards typically request som data from our DB and visualize them, with the updates being triggered from Interval components.

However, all the applications stop updating after exactly 8 hours. A simple F5 fixes this issue, but the users are not always aware that the application has ceased updating as there is no visual cue.

What could be the issue here? I suspect it is related to the identity provider but I also figured that many others should have encountered the same issue if this was the case (and my searches are coming up blank.)

I guess maybe it’s some issue with MySQL, cause the default wait_timeout param of MySQL is equal 8 hours, after that it automatically disconnects.

Yea this sounds like a timeout issue with your session connecting to mysql. You could do a few things:
1.) Ping the server every so often to keep the session alive, could use the interval component to do this.
2.) Set up connection pools so when one expires another gets picked up automatically
3.) Pay someone to sit at the computer 24/7 and hit enter every so often… (<–joking :smiley: )

1 Like

I would recommend using a connection pool, i.e. aka @tphil10 option (2). Using an Interval component to ping the connection is not a robust option, as it only fires if a client is connected. Hence, if no one uses your app for 8 hours in a row (e.g. during night/outside business hours), it would break.

Thank you for all your responses, much appreciated. I use MSSQL if that makes any difference here, and all calls to DB are within context managers that open and close the connections if that makes any difference.

I will try looking into connection pools, but I still think it’s related to authentication somehow. Note that my applications which use Django do not experience this but all Dash applications do.

Hello @nevershort,

If you have some flow to get a token, the token is probably expiring. Since a user refreshing fixes the issue, I think that your flow only sends an authentication request at the beginning.

How is the authentication happening? Do you have anything that will refresh the token?


I think you are absolutely correct. The user is only authenticating at the beginning through Active Directory.
I have tried making some ajax calls to /.auth/refresh through a clientside callback. The callback succeeded but the session still stopped after 8 hours. When I check the request.headers , the user has an access token (which expires hourly it seems) and a refresh token. I have no idea how to use the refresh token to get a new access token or how to store it. I supposed this must be happening automatically since the access token expires hourly and the app survives for 8 hours.

If it truly is expiring, then you need to figure out how to get the new token.

I think there is another endpoint where you pass the refresh token to for a new bearer token.

Hey everyone! I’m encountering a issue with my Plotly dashboards deployed on Azure App Service, and I’m hoping someone in the Plotly community can assist me. The dashboards utilize Interval components to fetch and display real-time data from various sources. However, I’ve noticed that the dashboards occasionally freeze or become unresponsive during the updates.

I’m using Microsoft as the identity provider for authentication in my application. I’ve checked the server logs and don’t see any errors or exceptions related to the freezing issue. Strangely, this problem seems to occur randomly and doesn’t follow a specific pattern. It’s highly disruptive because it disrupts the user experience and renders the dashboards temporarily unusable until a page refresh (F5) is performed. Can I get a answer here or I need to create a new topic? Regards

One guess could be that the update callback execution (for some reason) starts to take longer than the interval duration. This would case the update function to never return, and the dashboard would thus stop updating. However, with the current amount of information, it remains a guess. I would recommend creating a separate thread with more information, including a MWE that demonstrates the issue. That will make it easier for people to help resolving the issue :slight_smile:

The issue you’re facing with your applications ceasing updates after 8 hours could potentially be related to an authentication token expiration or a session timeout. Check the configuration settings for your identity providerand ensure that the tokens or sessions have a longer duration. Additionally, review the settings of your Azure App Service to ensure it is not causing any automatic restarts or disruptions. If the issue persists, consider reaching out to Microsoft support for further assistance with troubleshooting the specific scenario.

1 Like

Hi there,

The issue with your applications stopping updates after exactly 8 hours might be related to the Azure App Service’s idle timeout setting. When an application is idle for a specific period, it can be automatically unloaded, causing the updates to stop. A simple F5 (refresh) triggers the application to restart, which is why it starts updating again. You can try adjusting the idle timeout setting in the Azure App Service configuration to resolve this issue.