Currently, web apps are leaking memory and at some point will crash causing troubles. In small VMs, in few hours, so I wish to try to detect abnormal use of the memory over time, and move new connections to other instances not yet broken, and quit the problematic ones while firing new ones. The problem is that I wish to stop serving new sessions in the current one when I detect such condition, and wait everybody finish their tasks until the last user connected finish his job. That means: At some point, I wish to stop serving new connections, but letting the current users finish their jobs, and when I get ZERO active sessions, launch another app instance and quit.
How’s the best way to achieve such workaround? Suggestions?
I think you didn’t get it. I mean internally in the app.
I can try to find and infer the messed state IN the instance consulting the memory use. As I’m a Xojo Web newbie, how do I turn ON a “from now on deny new sessions but keep serving the current ones”?
I think that we don’t have a “Xojo way” of doing it, but probably I need to set a flag “block new sessions” and execute a Session.Quit right from inside of the WebSession.Opening event. The bad thing is that probably each attempt will leak a bit too.
I think I need to mature a bit more my understanding on how things are supposed to work in the current design, it’s not obvious. For example; the session.opening event occurs when session starts, but the session.closing is not the other way around, seems a propagation of app.closing instead of the end of the session. A refresh of the browser seems to orphanize sessions instead of reconnecting them. I think I’ll need to play a bit more. I had the impression that sessions are leaking, new ones starts and older ones seems not close, but I may be wrong, just not understanding the engine yet. But as we know, something is not ok. I hope you can find it and fix it. Good luck.
Seems not firing any kind of “Session ended” event, looks like as just setting some internal status for a “future”, if such opportunity happens, send a “disconnected” event. After a websession.Quit, if I refresh the browser, it sends a late “disconnected” event, if I do nothing, it just sits there quiet.