I have a general question about the onSessionEnded function: sometimes, my shiny app does not execute this function, but I can't figure out why. Therefore I am wondering if there were known reasons for which the function would be bypassed to help me debug it.
Have you deployed your app using Shiny Server, RStudio Connect, ShinyApps.io, etc.? There are some cases where R processes will be terminated while users are connected, in those cases you won't see session$onSessionEnded.
If that doesn't match the description of what you're seeing, it'd be helpful to have more details about what you're doing. Thanks!