We have recently gone through our SharePoint 2010 Health Analyzer entries and identified the item:
Expired Sessions are not being Deleted from the ASP.NET Session State Database
Following the guide https://blogs.msdn.microsoft.com/briangre/2013/09/09/expired-sessions-are-not-being-deleted-from-the-asp-net-session-state-database/ states that we need to disable and then re-enable SPSessionStateService using the following PowerShell commands:
Disable-SPSessionStateService Enable-SPSessionStateService –DefaultProvision
The commands completed successfully but we have identified a problem where an
XsltListViewWebPart now displays the following error:
Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
Correlation ID: << some correlation ID >>
If we open the site in SharePoint Designer and simply save the page (without any editing) we can refresh the page and the web part works fine...
Additionally, if we leave the site (e.g. go home for the night and come back to it the next day) then the web part stops working again. If we open it back in SharePoint designer and save then it works fine again.
To stress, we have literally only just ran the above command to disable and then re-enable the SPSessionStateService (and made sure the account has the right permissions on SQL server).
I'm leaning towards the fact we've made this change and now something's messed up somewhere... and with the fact we're dealing with "session" stuff, that the web part loses the session and then can't seem to regain it (but not sure how "saving" the web part through Designer would fix this, albeit temporarily)?