I've got a memory leak issue in Ignition, where Ignition keeps a page running after you close the browser tab. This affects memory and processor on both the client and server, as (in this case) I've got data updating on a timer, so updates continue to happen indefinitely, as far as I can tell.
I've made a simplified example - essentially, a test view which just has a custom parameter bound to a five second timer, printing out the page id to the logs. This shows that the page remains running when the browser tab is closed.
If I then open the page again in another tab, a second page id starts printing to the log, and so on, for as many times as I do this, until my computer starts to melt. In this shot, I have now Perspective tabs left open, and yet...
Update: this seems to happen even with pages with no timers, or refresh code, etc.
I've been logging the number of active pages in the session (sourced from system.perspective.getSessionInfo()), and once a page is created, it doesn't seem to go away until I manually kill the session (or, until the Trial Mode on my dev box times out after two hours).
I've also checked this on our production server - I opened a page in a new tab and then immeditately closed it, then repeated this a few times - and they never seem to close. The session is still there an hour later, with all the pages still active.
With the shutdown being called the session should be closing. I am curious if this occurs in the most recent version of Ignition? Also do you have a screenshot of the status>performance page?
Yeah, it should be! But the shutdown only seems to get called when navigating to another perspective page, not when simply closing the browser tab. (I've got logging on the onShutdown event to check this).
I checked the status>performance page as you suggested, and something does seem to be clearing out the memory, which is good (the memory clears down to a base amount and then rapidly climbs again, before being cleared again). So maybe I'm needlessly worrying about it. Although, the timed scripts all seem to still be running (as seen in the logs), which really doesn't seem right.
More explicitly:
There is no way to distinguish, on the backend, between "the user closed the tab explicitly" and "the user's network connection dropped out". So if you give your sessions long timeouts, be aware that you're keeping a potentially heavy gateway resource around for a long time.
Just to clarify, sessions hold page ids, and page ids that are closed by the user by closing a tab are not released until the session timeout expires and there's been no keep alive sent for that page id?
Right...shouldn't it be possible to detect that the session is still connected (because it is still talking to the server, and therefore the network connection is still up), but a particular page within that session has closed?
Is there a way to know if the page/tab timeout is actively counting?
(I assume its always counting up because general network comms etc, but an earlier indicator)