TLDR: It’d be great if you could test your dashboards as I’ve found some issues with session state that required some work and I want to make sure everything is solid.
As always you can download the latest nightly using this script: https://github.com/ironmansoftware/universal-dashboard/blob/master/tools/install-nightly.ps1
After some discussion on some other threads (primarily this one: Collection was modified; enumeration operation may not execute) as well as a couple of issues around session and cache, I’ve identified a pretty gnarly issue that was causing sessions to stomp on each other, endpoints to not be cleaned up properly and various other issues that would cause strange things to happen.
I’ve made a couple of fixes that everyone should be aware of and if you have the opportunity, it would be great if you could run a test of the latest nightly against your dashboard.
Connection IDs are tied to session IDs
Connection IDs (SignalR) are tied to session IDs such that when you call something like Set-UDElement or Show-UDModal, the session ID will be used to locate the Connection ID and then an event will be sent. This works great until you have 2 windows open. The first window will stop functioning and the second one may receive events from the first. Ew.
I’ve resolved this by tying multiple connection IDs to the same session ID. Now your events should end up in the correct window.
Session Clean up after a window is closed
There is no way in ASP.NET Core to determine when a session has expired from the server. There is a cookie on the client with a life-time but no way to check to see if a particular session has expired from the server end. To combat this, UD was supposed to be cleaning up sessions after the window was closed. Cleaning up sessions meant getting rid of Endpoints generated during the session and any variables that were set.
This wasn’t happening at all. This meant that every time you open a new window and you used any dynamic endpoints within dynamic endpoints or $Session scope variables, they would live forever. This is painfully obvious on long-running dashboards that eventually max out CPU and run out of memory.
I fixed this by correctly cleaning up after the last window is closed.
The global cache was a ASP.NET MemoryCache that contained anything you put in the $Cache scope. No cache management was applied to these entries so they would live forever. This isn’t a huge deal unless you are heavily using auto-generated variable names or super large data sets but it was still really tricky to clear out the cache.
I’ve introduced a new Clear-UDCache cmdlet that will do just that. If there is ever a time you want to clear that cache (maybe once a night or something), you can now do so at your convenience.